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
- #commands ⇒ Qonfig::CommandSet private
- #compose(data_set_klass) ⇒ void 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
- #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
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 |
# File 'lib/qonfig/dsl.rb', line 12 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.
29 30 31 |
# File 'lib/qonfig/dsl.rb', line 29 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.
58 59 60 |
# File 'lib/qonfig/dsl.rb', line 58 def compose(data_set_klass) commands << Qonfig::Commands::Compose.new(data_set_klass) end |
#expose_json(file_path, strict: true, via:, env:) ⇒ void
This method returns an undefined value.
131 132 133 |
# File 'lib/qonfig/dsl.rb', line 131 def expose_json(file_path, strict: true, via:, env:) commands << Qonfig::Commands::ExposeJSON.new(file_path, strict: strict, via: via, env: env) end |
#expose_self(env:, format: :yaml) ⇒ void
This method returns an undefined value.
142 143 144 145 |
# File 'lib/qonfig/dsl.rb', line 142 def expose_self(env:, format: :yaml) caller_location = caller(1, 1).first commands << Qonfig::Commands::ExposeSelf.new(caller_location, env: env, format: format) end |
#expose_toml(file_path, strict: true, via:, env:) ⇒ void
This method returns an undefined value.
24 25 26 |
# File 'lib/qonfig/plugins/toml/dsl.rb', line 24 def expose_toml(file_path, strict: true, via:, env:) 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.
119 120 121 |
# File 'lib/qonfig/dsl.rb', line 119 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.
93 94 95 96 97 98 99 |
# File 'lib/qonfig/dsl.rb', line 93 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.
107 108 109 |
# File 'lib/qonfig/dsl.rb', line 107 def load_from_json(file_path, strict: true) commands << Qonfig::Commands::LoadFromJSON.new(file_path, strict: strict) end |
#load_from_self(format: :yaml) ⇒ void
This method returns an undefined value.
80 81 82 83 |
# File 'lib/qonfig/dsl.rb', line 80 def load_from_self(format: :yaml) caller_location = caller(1, 1).first commands << Qonfig::Commands::LoadFromSelf.new(caller_location, format: format) end |
#load_from_toml(file_path, strict: true) ⇒ void
This method returns an undefined value.
12 13 14 |
# File 'lib/qonfig/plugins/toml/dsl.rb', line 12 def load_from_toml(file_path, strict: true) commands << Qonfig::Commands::LoadFromTOML.new(file_path, strict: strict) end |
#load_from_yaml(file_path, strict: true) ⇒ void
This method returns an undefined value.
70 71 72 |
# File 'lib/qonfig/dsl.rb', line 70 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.
43 44 45 46 47 48 49 |
# File 'lib/qonfig/dsl.rb', line 43 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 |