Module: Qonfig::DSL Private
- Included in:
- DataSet
- Defined in:
- lib/qonfig/dsl.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .extended(child_klass) ⇒ void private
Instance Method Summary collapse
- #commands ⇒ Qonfig::CommandSet private
- #compose(data_set_klass) ⇒ void private
- #expose_yaml(file_path, strict: true, via:, env:) ⇒ void
- #load_from_env(convert_values: false, prefix: nil, trim_prefix: false) ⇒ void
- #load_from_json(file_path, strict: true) ⇒ void
- #load_from_self ⇒ void
- #load_from_yaml(file_path, strict: true) ⇒ void
- #setting(key, initial_value = nil, &nested_settings) ⇒ void
Class Method Details
.extended(child_klass) ⇒ 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.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/qonfig/dsl.rb', line 13 def extended(child_klass) child_klass.instance_variable_set(:@commands, Qonfig::CommandSet.new) child_klass.singleton_class.prepend(Module.new do def inherited(child_klass) child_klass.instance_variable_set(:@commands, Qonfig::CommandSet.new) child_klass.commands.concat(commands) super end end) end |
Instance Method Details
#commands ⇒ Qonfig::CommandSet
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.
30 31 32 |
# File 'lib/qonfig/dsl.rb', line 30 def commands @commands end |
#compose(data_set_klass) ⇒ 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.
59 60 61 |
# File 'lib/qonfig/dsl.rb', line 59 def compose(data_set_klass) commands << Qonfig::Commands::Compose.new(data_set_klass) end |
#expose_yaml(file_path, strict: true, via:, env:) ⇒ void
This method returns an undefined value.
120 121 122 |
# File 'lib/qonfig/dsl.rb', line 120 def expose_yaml(file_path, strict: true, via:, env:) commands << Qonfig::Commands::ExposeYAML.new(file_path, strict: strict, via: via, env: env) end |
#load_from_env(convert_values: false, prefix: nil, trim_prefix: false) ⇒ void
This method returns an undefined value.
94 95 96 97 98 99 100 |
# File 'lib/qonfig/dsl.rb', line 94 def load_from_env(convert_values: false, prefix: nil, trim_prefix: false) commands << Qonfig::Commands::LoadFromENV.new( convert_values: convert_values, prefix: prefix, trim_prefix: trim_prefix ) end |
#load_from_json(file_path, strict: true) ⇒ void
This method returns an undefined value.
108 109 110 |
# File 'lib/qonfig/dsl.rb', line 108 def load_from_json(file_path, strict: true) commands << Qonfig::Commands::LoadFromJSON.new(file_path, strict: strict) end |
#load_from_self ⇒ void
This method returns an undefined value.
81 82 83 84 |
# File 'lib/qonfig/dsl.rb', line 81 def load_from_self caller_location = caller(1, 1).first commands << Qonfig::Commands::LoadFromSelf.new(caller_location) end |
#load_from_yaml(file_path, strict: true) ⇒ void
This method returns an undefined value.
71 72 73 |
# File 'lib/qonfig/dsl.rb', line 71 def load_from_yaml(file_path, strict: true) commands << Qonfig::Commands::LoadFromYAML.new(file_path, strict: strict) end |
#setting(key, initial_value = nil, &nested_settings) ⇒ void
This method returns an undefined value.
44 45 46 47 48 49 50 |
# File 'lib/qonfig/dsl.rb', line 44 def setting(key, initial_value = nil, &nested_settings) if block_given? commands << Qonfig::Commands::AddNestedOption.new(key, nested_settings) else commands << Qonfig::Commands::AddOption.new(key, initial_value) end end |