Class: Qonfig::Commands::Definition::ReDefineOption Private
- Defined in:
- lib/qonfig/commands/definition/re_define_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 ⇒ Proc, NilClass readonly private
- #value ⇒ Object readonly private
Instance Method Summary collapse
- #call(data_set, settings) ⇒ void private
-
#initialize(key, value, nested_definitions) ⇒ ReDefineOption
constructor
private
A new instance of ReDefineOption.
Methods inherited from Base
inheritable=, inheritable?, #inheritable?, inherited
Constructor Details
#initialize(key, value, nested_definitions) ⇒ ReDefineOption
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 ReDefineOption.
35 36 37 38 39 40 41 42 43 |
# File 'lib/qonfig/commands/definition/re_define_option.rb', line 35 def initialize(key, value, nested_definitions) Qonfig::Settings::KeyGuard.prevent_incomparabilities!(key) @key = key @value = value @nested_data_set_klass = Class.new(Qonfig::DataSet).tap do |data_set| data_set.instance_eval(&nested_definitions) end if nested_definitions 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/re_define_option.rb', line 13 def key @key end |
#nested_data_set_klass ⇒ Proc, NilClass (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.
25 26 27 |
# File 'lib/qonfig/commands/definition/re_define_option.rb', line 25 def nested_data_set_klass @nested_data_set_klass end |
#value ⇒ 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.
19 20 21 |
# File 'lib/qonfig/commands/definition/re_define_option.rb', line 19 def value @value 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.
51 52 53 54 55 56 57 58 59 |
# File 'lib/qonfig/commands/definition/re_define_option.rb', line 51 def call(data_set, settings) if nested_data_set_klass nested_settings = nested_data_set_klass.new.settings nested_settings.__mutation_callbacks__.add(settings.__mutation_callbacks__) settings.__define_setting__(key, nested_settings, with_redefinition: true) else settings.__define_setting__(key, value, with_redefinition: true) end end |