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.
Methods inherited from Base
inheritable=, inheritable?, #inheritable?, inherited
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.
29 30 31 32 33 34 35 36 |
# File 'lib/qonfig/commands/definition/add_nested_option.rb', line 29 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.
13 14 15 |
# File 'lib/qonfig/commands/definition/add_nested_option.rb', line 13 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.
19 20 21 |
# File 'lib/qonfig/commands/definition/add_nested_option.rb', line 19 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.
44 45 46 47 48 49 |
# File 'lib/qonfig/commands/definition/add_nested_option.rb', line 44 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 |