Class: Dry::Configurable::Extension Private
- Inherits:
-
Module
- Object
- Module
- Dry::Configurable::Extension
- Defined in:
- lib/dry/configurable/extension.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #config_class ⇒ Object readonly private
- #default_undefined ⇒ Object readonly private
Instance Method Summary collapse
- #extended(klass) ⇒ Object private
- #included(klass) ⇒ Object private
-
#initialize(config_class: Configurable::Config, default_undefined: false) ⇒ Extension
constructor
private
A new instance of Extension.
Constructor Details
#initialize(config_class: Configurable::Config, default_undefined: false) ⇒ Extension
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.
Returns a new instance of Extension.
13 14 15 16 17 18 |
# File 'lib/dry/configurable/extension.rb', line 13 def initialize(config_class: Configurable::Config, default_undefined: false) super() @config_class = config_class @default_undefined = default_undefined freeze end |
Instance Attribute Details
#config_class ⇒ Object (readonly)
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.
7 8 9 |
# File 'lib/dry/configurable/extension.rb', line 7 def config_class @config_class end |
#default_undefined ⇒ Object (readonly)
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.
10 11 12 |
# File 'lib/dry/configurable/extension.rb', line 10 def default_undefined @default_undefined end |
Instance Method Details
#extended(klass) ⇒ Object
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.
21 22 23 24 25 |
# File 'lib/dry/configurable/extension.rb', line 21 def extended(klass) super klass.extend(ClassMethods) klass.instance_variable_set(:@__config_extension__, self) end |
#included(klass) ⇒ Object
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.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/dry/configurable/extension.rb', line 28 def included(klass) super klass.class_eval do extend(ClassMethods) include(InstanceMethods) prepend(Initializer) class << self undef :config if method_defined?(:config) undef :configure if method_defined?(:configure) end end klass.instance_variable_set(:@__config_extension__, self) end |