Module: Qonfig::DSL Private
- Defined in:
- lib/qonfig/dsl.rb,
lib/qonfig/plugins/toml/dsl.rb,
lib/qonfig/plugins/vault/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.
Defined Under Namespace
Modules: Inheritance
Class Method Summary collapse
-
.extended(child_klass) ⇒ void
private
rubocop:disable Layout/LineLength, Metrics/AbcSize.
Instance Method Summary collapse
- #compose(data_set_klass) ⇒ void private
- #define_validator(name, &validation_logic) ⇒ void
- #definition_commands ⇒ Qonfig::CommandSet private
- #expose_json(file_path, strict: true, via:, env:) ⇒ void
- #expose_self(env:, format: :dynamic) ⇒ void
- #expose_toml(file_path, strict: true, via:, env:) ⇒ void
- #expose_vault(path, strict: true, via:, env:) ⇒ void
- #expose_yaml(file_path, strict: true, via:, env:) ⇒ void
- #freeze_state! ⇒ 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: :dynamic) ⇒ void
- #load_from_toml(file_path, strict: true) ⇒ void
- #load_from_vault(path, strict: true) ⇒ void
- #load_from_yaml(file_path, strict: true) ⇒ void
- #predefined_validators ⇒ Qonfig::Validation::Collections::PredefinedRegistry private
- #re_setting(key, initial_value = nil, &nested_settings) ⇒ void
- #setting(key, initial_value = nil, &nested_settings) ⇒ void
- #validate(setting_key_pattern = nil, predefined = nil, strict: false, by: nil, &custom_validation) ⇒ void
- #validators ⇒ Qonfig::Validation::Collections::InstanceCollection private
- #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.
rubocop:disable Layout/LineLength, Metrics/AbcSize
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/qonfig/dsl.rb', line 19 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.instance_variable_set(:@predefined_validators, Qonfig::Validation::Collections::PredefinedRegistry.new) child_klass.instance_variable_set(:@validators, Qonfig::Validation::Collections::InstanceCollection.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.instance_variable_set(:@predefined_validators, Qonfig::Validation::Collections::PredefinedRegistry.new) child_klass.instance_variable_set(:@validators, Qonfig::Validation::Collections::InstanceCollection.new) Qonfig::DSL::Inheritance.inherit(base: self, child: child_klass) 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.
153 154 155 |
# File 'lib/qonfig/dsl.rb', line 153 def compose(data_set_klass) definition_commands << Qonfig::Commands::Definition::Compose.new(data_set_klass) end |
#define_validator(name, &validation_logic) ⇒ void
This method returns an undefined value.
107 108 109 110 111 |
# File 'lib/qonfig/dsl.rb', line 107 def define_validator(name, &validation_logic) Qonfig::Validation::Building::PredefinedBuilder.build( name, validation_logic, predefined_validators ) 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.
43 44 45 |
# File 'lib/qonfig/dsl.rb', line 43 def definition_commands @definition_commands end |
#expose_json(file_path, strict: true, via:, env:) ⇒ void
This method returns an undefined value.
241 242 243 244 245 |
# File 'lib/qonfig/dsl.rb', line 241 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: :dynamic) ⇒ void
This method returns an undefined value.
256 257 258 259 260 261 262 |
# File 'lib/qonfig/dsl.rb', line 256 def expose_self(env:, format: :dynamic) caller_location = ::Kernel.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.
32 33 34 35 36 |
# File 'lib/qonfig/plugins/toml/dsl.rb', line 32 def expose_toml(file_path, strict: true, via:, env:) definition_commands << Qonfig::Commands::Definition::ExposeTOML.new( file_path, strict: strict, via: via, env: env ) end |
#expose_vault(path, strict: true, via:, env:) ⇒ void
This method returns an undefined value.
30 31 32 33 34 |
# File 'lib/qonfig/plugins/vault/dsl.rb', line 30 def expose_vault(path, strict: true, via:, env:) definition_commands << Qonfig::Commands::Definition::ExposeVault.new( path, strict: strict, via: via, env: env ) end |
#expose_yaml(file_path, strict: true, via:, env:) ⇒ void
This method returns an undefined value.
225 226 227 228 229 |
# File 'lib/qonfig/dsl.rb', line 225 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 |
#freeze_state! ⇒ void
This method returns an undefined value.
288 289 290 |
# File 'lib/qonfig/dsl.rb', line 288 def freeze_state! instance_commands << Qonfig::Commands::Instantiation::FreezeState.new 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.
51 52 53 |
# File 'lib/qonfig/dsl.rb', line 51 def instance_commands @instance_commands end |
#load_from_env(convert_values: false, prefix: nil, trim_prefix: false) ⇒ void
This method returns an undefined value.
195 196 197 198 199 200 201 |
# File 'lib/qonfig/dsl.rb', line 195 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.
211 212 213 |
# File 'lib/qonfig/dsl.rb', line 211 def load_from_json(file_path, strict: true) definition_commands << Qonfig::Commands::Definition::LoadFromJSON.new(file_path, strict: strict) end |
#load_from_self(format: :dynamic) ⇒ void
This method returns an undefined value.
179 180 181 182 183 184 185 |
# File 'lib/qonfig/dsl.rb', line 179 def load_from_self(format: :dynamic) caller_location = ::Kernel.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.
15 16 17 18 19 |
# File 'lib/qonfig/plugins/toml/dsl.rb', line 15 def load_from_toml(file_path, strict: true) definition_commands << Qonfig::Commands::Definition::LoadFromTOML.new( file_path, strict: strict ) end |
#load_from_vault(path, strict: true) ⇒ void
This method returns an undefined value.
14 15 16 17 18 |
# File 'lib/qonfig/plugins/vault/dsl.rb', line 14 def load_from_vault(path, strict: true) definition_commands << Qonfig::Commands::Definition::LoadFromVault.new( path, strict: strict ) end |
#load_from_yaml(file_path, strict: true) ⇒ void
This method returns an undefined value.
165 166 167 168 169 |
# File 'lib/qonfig/dsl.rb', line 165 def load_from_yaml(file_path, strict: true) definition_commands << Qonfig::Commands::Definition::LoadFromYAML.new( file_path, strict: strict ) end |
#predefined_validators ⇒ Qonfig::Validation::Collections::PredefinedRegistry
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.
59 60 61 |
# File 'lib/qonfig/dsl.rb', line 59 def predefined_validators @predefined_validators end |
#re_setting(key, initial_value = nil, &nested_settings) ⇒ void
This method returns an undefined value.
140 141 142 143 144 |
# File 'lib/qonfig/dsl.rb', line 140 def re_setting(key, initial_value = nil, &nested_settings) definition_commands << Qonfig::Commands::Definition::ReDefineOption.new( key, initial_value, nested_settings ) end |
#setting(key, initial_value = nil, &nested_settings) ⇒ void
This method returns an undefined value.
123 124 125 126 127 128 129 |
# File 'lib/qonfig/dsl.rb', line 123 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 |
#validate(setting_key_pattern = nil, predefined = nil, strict: false, by: nil, &custom_validation) ⇒ void
This method returns an undefined value.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/qonfig/dsl.rb', line 82 def validate( setting_key_pattern = nil, predefined = nil, strict: false, by: nil, &custom_validation ) validators << Qonfig::Validation::Building::InstanceBuilder.build( self, setting_key_pattern: setting_key_pattern, predefined_validator: predefined, runtime_validation_method: by, strict: strict, validation_logic: custom_validation ) end |
#validators ⇒ Qonfig::Validation::Collections::InstanceCollection
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.
67 68 69 |
# File 'lib/qonfig/dsl.rb', line 67 def validators @validators end |
#values_file(file_path, format: :dynamic, strict: false, expose: nil) ⇒ void
This method returns an undefined value.
274 275 276 277 278 279 280 |
# File 'lib/qonfig/dsl.rb', line 274 def values_file(file_path, format: :dynamic, strict: false, expose: nil) caller_location = ::Kernel.caller(1, 1).first instance_commands << Qonfig::Commands::Instantiation::ValuesFile.new( file_path, caller_location, format: format, strict: strict, expose: expose ) end |