Class: EacRubyUtils::ModuleAncestorsVariable::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_utils/module_ancestors_variable/base.rb

Direct Known Subclasses

Hash, Set

Instance Method Summary collapse

Instance Method Details

#ancestors_variableObject

return [Hash]



18
19
20
21
22
23
24
25
26
# File 'lib/eac_ruby_utils/module_ancestors_variable/base.rb', line 18

def ancestors_variable
  the_module.ancestors.inject(initial_value.dup) do |a, e|
    if e.respond_to?(method_name, true)
      merge_operation(a, e.send(method_name).send(:self_variable))
    else
      a
    end
  end
end

#merge_operation(current, other) ⇒ Object

Parameters:

Returns:



13
14
15
# File 'lib/eac_ruby_utils/module_ancestors_variable/base.rb', line 13

def merge_operation(current, other)
  current.merge(other)
end

#self_variableHash

Returns:



29
30
31
# File 'lib/eac_ruby_utils/module_ancestors_variable/base.rb', line 29

def self_variable
  @self_variable ||= initial_value.dup
end