Class: Qonfig::Commands::Definition::AddNestedOption Private
- Defined in:
- lib/qonfig/commands/definition/add_nested_option.rb
Overview
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
- #key ⇒ Symbol, String readonly private
- #nested_data_set_klass ⇒ Class<Qonfig::DataSet> readonly private
Instance Method Summary collapse
- #call(data_set, settings) ⇒ void private
-
#initialize(key, nested_definitions) ⇒ AddNestedOption
constructor
private
A new instance of AddNestedOption.
Constructor Details
#initialize(key, nested_definitions) ⇒ AddNestedOption
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 AddNestedOption.
26 27 28 29 30 31 32 33 |
# File 'lib/qonfig/commands/definition/add_nested_option.rb', line 26 def initialize(key, nested_definitions) Qonfig::Settings::KeyGuard.prevent_incomparabilities!(key) @key = key @nested_data_set_klass = Class.new(Qonfig::DataSet).tap do |data_set| data_set.instance_eval(&nested_definitions) end end |
Instance Attribute Details
#key ⇒ Symbol, String (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/qonfig/commands/definition/add_nested_option.rb', line 10 def key @key end |
#nested_data_set_klass ⇒ Class<Qonfig::DataSet> (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.
16 17 18 |
# File 'lib/qonfig/commands/definition/add_nested_option.rb', line 16 def nested_data_set_klass @nested_data_set_klass end |
Instance Method Details
#call(data_set, settings) ⇒ 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.
41 42 43 44 45 46 |
# File 'lib/qonfig/commands/definition/add_nested_option.rb', line 41 def call(data_set, settings) nested_settings = nested_data_set_klass.new.settings nested_settings.__mutation_callbacks__.add(settings.__mutation_callbacks__) settings.__define_setting__(key, nested_settings) end |