Module: SmartCore::Initializer::DSL::ClassInheritance Private

Defined in:
lib/smart_core/initializer/dsl.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Version:

  • 0.10.0

Instance Method Summary collapse

Instance Method Details

#inherited(child_klass) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • child_klass (Class)

Since:

  • 0.1.0

Version:

  • 0.10.0



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/smart_core/initializer/dsl.rb', line 39

def inherited(child_klass)
  child_klass.instance_exec(__initializer_settings__) do |init_settings|
    instance_variable_set(:@__params__, SmartCore::Initializer::Attribute::List.new)
    instance_variable_set(:@__options__, SmartCore::Initializer::Attribute::List.new)
    instance_variable_set(:@__init_extensions__, SmartCore::Initializer::Extensions::List.new)
    instance_variable_set(:@__definer__, SmartCore::Initializer::Constructor::Definer.new(self))
    instance_variable_set(:@__initializer_settings__, init_settings.dup)
  end
  child_klass.extend(ClassMethods)
  SmartCore::Initializer::DSL::Inheritance.inherit(base: self, child: child_klass)
  child_klass.singleton_class.prepend(ClassInheritance)
  super
end