Class: Dry::Configurable::NestedConfig
- Inherits:
-
Object
- Object
- Dry::Configurable::NestedConfig
- Defined in:
- lib/dry/configurable/nested_config.rb
Instance Method Summary collapse
- #create_config ⇒ Object
-
#initialize(&block) ⇒ NestedConfig
constructor
A new instance of NestedConfig.
Constructor Details
#initialize(&block) ⇒ NestedConfig
Returns a new instance of NestedConfig.
5 6 7 8 9 |
# File 'lib/dry/configurable/nested_config.rb', line 5 def initialize(&block) klass = ::Class.new { extend ::Dry::Configurable } klass.instance_eval(&block) @klass = klass end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
24 25 26 |
# File 'lib/dry/configurable/nested_config.rb', line 24 def method_missing(method, *args, &block) config.respond_to?(method) ? config.public_send(method, *args, &block) : super end |
Instance Method Details
#create_config ⇒ Object
12 13 14 15 16 |
# File 'lib/dry/configurable/nested_config.rb', line 12 def create_config if @klass.instance_variables.include?(:@_config) @klass.__send__(:create_config) end end |