module TheFactory::InheritanceHelpers

Public Instance Methods

__mf_included_composite_modules__() click to toggle source
# File lib/the_factory/inheritance_helpers.rb, line 14
def __mf_included_composite_modules__
  TheFactory.registered_modules & included_modules
end
__mf_inheritance_activate_parent_components_of_composite__(composite) click to toggle source
# File lib/the_factory/inheritance_helpers.rb, line 26
def __mf_inheritance_activate_parent_components_of_composite__(composite)
  superclass.public_send("#{composite.__mf_registry_method_name__}").each do |component, klass|
    public_send(composite.__mf_store_method_name__, component, klass)
  end
end
__mf_inheritance_reactivate_composites__() click to toggle source
# File lib/the_factory/inheritance_helpers.rb, line 7
def __mf_inheritance_reactivate_composites__
  __mf_included_composite_modules__.each do |composite|
    __mf_inheritance_store_parent_components_of_composite__(composite)
    __mf_inheritance_activate_parent_components_of_composite__(composite)
  end
end
__mf_inheritance_store_parent_components_of_composite__(composite) click to toggle source
# File lib/the_factory/inheritance_helpers.rb, line 18
def __mf_inheritance_store_parent_components_of_composite__(composite)
  readers_regexp = Regexp.new("\w+_#{composite.component_name}_class\\z")
  superclass.public_methods.grep(readers_regexp).each do |reader_method|
    klass = superclass.public_send(reader_method)
    send(:"#{reader_method}=", klass)
  end
end
inherited(subclass) click to toggle source
# File lib/the_factory/inheritance_helpers.rb, line 3
def inherited(subclass)
  subclass.__mf_inheritance_reactivate_composites__
end