Module: Qonfig::DSL Private
- Included in:
- DataSet
- Defined in:
- lib/qonfig/dsl.rb,
lib/qonfig/plugins/toml/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
- #compose(data_set_klass) ⇒ void private
- #definition_commands ⇒ Qonfig::CommandSet private
- #expose_json(file_path, strict: true, via:, env:) ⇒ void
- #expose_self(env:, format: :yaml) ⇒ void
- #expose_toml(file_path, strict: true, via:, env:) ⇒ void
- #expose_yaml(file_path, strict: true, via:, env:) ⇒ void
- #instance_commands ⇒ Qonfig::CommandSet private
- #load_from_env(convert_values: false, prefix: nil, trim_prefix: false) ⇒ void
- #load_from_json(file_path, strict: true) ⇒ void
- #load_from_self(format: :yaml) ⇒ void
- #load_from_toml(file_path, strict: true) ⇒ void
- #load_from_yaml(file_path, strict: true) ⇒ void
- #setting(key, initial_value = nil, &nested_settings) ⇒ void
- #values_file(file_path, format: :dynamic, strict: false, expose: nil) ⇒ 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.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/qonfig/dsl.rb', line 12 def extended(child_klass) child_klass.instance_variable_set(:@definition_commands, Qonfig::CommandSet.new) child_klass.instance_variable_set(:@instance_commands, Qonfig::CommandSet.new) child_klass.singleton_class.prepend(Module.new do def inherited(child_klass) child_klass.instance_variable_set(:@definition_commands, Qonfig::CommandSet.new) child_klass.instance_variable_set(:@instance_commands, Qonfig::CommandSet.new) child_klass.definition_commands.concat(definition_commands) child_klass.instance_commands.concat(instance_commands) super end end) end |
Instance Method Details
#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.
70 71 72 |
# File 'lib/qonfig/dsl.rb', line 70 def compose(data_set_klass) definition_commands << Qonfig::Commands::Definition::Compose.new(data_set_klass) end |
#definition_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.
33 34 35 |
# File 'lib/qonfig/dsl.rb', line 33 def definition_commands @definition_commands end |
#expose_json(file_path, strict: true, via:, env:) ⇒ void
This method returns an undefined value.
150 151 152 153 154 |
# File 'lib/qonfig/dsl.rb', line 150 def expose_json(file_path, strict: true, via:, env:) definition_commands << Qonfig::Commands::Definition::ExposeJSON.new( file_path, strict: strict, via: via, env: env ) end |
#expose_self(env:, format: :yaml) ⇒ void
This method returns an undefined value.
163 164 165 166 167 168 169 |
# File 'lib/qonfig/dsl.rb', line 163 def expose_self(env:, format: :yaml) caller_location = caller(1, 1).first definition_commands << Qonfig::Commands::Definition::ExposeSelf.new( caller_location, env: env, format: format ) end |
#expose_toml(file_path, strict: true, via:, env:) ⇒ void
This method returns an undefined value.
26 27 28 29 30 |
# File 'lib/qonfig/plugins/toml/dsl.rb', line 26 def expose_toml(file_path, strict: true, via:, env:) definition_commands << Qonfig::Commands::ExposeTOML.new( file_path, strict: strict, via: via, env: env ) end |
#expose_yaml(file_path, strict: true, via:, env:) ⇒ void
This method returns an undefined value.
136 137 138 139 140 |
# File 'lib/qonfig/dsl.rb', line 136 def expose_yaml(file_path, strict: true, via:, env:) definition_commands << Qonfig::Commands::Definition::ExposeYAML.new( file_path, strict: strict, via: via, env: env ) end |
#instance_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.
41 42 43 |
# File 'lib/qonfig/dsl.rb', line 41 def instance_commands @instance_commands end |
#load_from_env(convert_values: false, prefix: nil, trim_prefix: false) ⇒ void
This method returns an undefined value.
110 111 112 113 114 115 116 |
# File 'lib/qonfig/dsl.rb', line 110 def load_from_env(convert_values: false, prefix: nil, trim_prefix: false) definition_commands << Qonfig::Commands::Definition::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.
124 125 126 |
# File 'lib/qonfig/dsl.rb', line 124 def load_from_json(file_path, strict: true) definition_commands << Qonfig::Commands::Definition::LoadFromJSON.new(file_path, strict: strict) end |
#load_from_self(format: :yaml) ⇒ void
This method returns an undefined value.
94 95 96 97 98 99 100 |
# File 'lib/qonfig/dsl.rb', line 94 def load_from_self(format: :yaml) caller_location = caller(1, 1).first definition_commands << Qonfig::Commands::Definition::LoadFromSelf.new( caller_location, format: format ) end |
#load_from_toml(file_path, strict: true) ⇒ void
This method returns an undefined value.
12 13 14 15 16 |
# File 'lib/qonfig/plugins/toml/dsl.rb', line 12 def load_from_toml(file_path, strict: true) definition_commands << Qonfig::Commands::LoadFromTOML.new( file_path, strict: strict ) end |
#load_from_yaml(file_path, strict: true) ⇒ void
This method returns an undefined value.
82 83 84 85 86 |
# File 'lib/qonfig/dsl.rb', line 82 def load_from_yaml(file_path, strict: true) definition_commands << Qonfig::Commands::Definition::LoadFromYAML.new( file_path, strict: strict ) end |
#setting(key, initial_value = nil, &nested_settings) ⇒ void
This method returns an undefined value.
55 56 57 58 59 60 61 |
# File 'lib/qonfig/dsl.rb', line 55 def setting(key, initial_value = nil, &nested_settings) if block_given? definition_commands << Qonfig::Commands::Definition::AddNestedOption.new(key, nested_settings) else definition_commands << Qonfig::Commands::Definition::AddOption.new(key, initial_value) end end |
#values_file(file_path, format: :dynamic, strict: false, expose: nil) ⇒ void
This method returns an undefined value.
179 180 181 182 183 184 185 |
# File 'lib/qonfig/dsl.rb', line 179 def values_file(file_path, format: :dynamic, strict: false, expose: nil) caller_location = caller(1, 1).first instance_commands << Qonfig::Commands::Instantiation::ValuesFile.new( file_path, caller_location, format: format, strict: strict, expose: expose ) end |