Module: Algebrick::Reclude

Included in:
Type
Defined in:
lib/algebrick/reclude.rb

Overview

fix module to re-include itself to where it was already included when a module is included into it noinspection RubySuperCallWithoutSuperclassInspection

Instance Method Summary (collapse)

Instance Method Details

- (Object) include(*modules)



24
25
26
27
28
29
30
31
# File 'lib/algebrick/reclude.rb', line 24

def include(*modules)
  super(*modules)
  modules.reverse.each do |module_being_included|
    included_into.each do |mod|
      mod.send :include, module_being_included
    end
  end
end

- (Object) included(base)



19
20
21
22
# File 'lib/algebrick/reclude.rb', line 19

def included(base)
  included_into << base
  super(base)
end

- (Object) included_into (private)



35
36
37
# File 'lib/algebrick/reclude.rb', line 35

def included_into
  @included_into ||= []
end