Class: Qonfig::Commands::ExposeSelf Private
- Defined in:
- lib/qonfig/commands/expose_self.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
- #caller_location ⇒ String readonly private
- #env ⇒ Symbol, String readonly private
Instance Method Summary collapse
- #call(data_set, settings) ⇒ void private
-
#initialize(caller_location, env:) ⇒ ExposeSelf
constructor
private
A new instance of ExposeSelf.
Constructor Details
#initialize(caller_location, env:) ⇒ ExposeSelf
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 ExposeSelf.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/qonfig/commands/expose_self.rb', line 23 def initialize(caller_location, env:) unless env.is_a?(Symbol) || env.is_a?(String) raise Qonfig::ArgumentError, ':env should be a string or a symbol' end if env.to_s.empty? raise Qonfig::ArgumentError, ':env should be provided' end @caller_location = caller_location @env = env end |
Instance Attribute Details
#caller_location ⇒ 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.
10 11 12 |
# File 'lib/qonfig/commands/expose_self.rb', line 10 def caller_location @caller_location end |
#env ⇒ 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.
16 17 18 |
# File 'lib/qonfig/commands/expose_self.rb', line 16 def env @env 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.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/qonfig/commands/expose_self.rb', line 42 def call(data_set, settings) yaml_data = load_self_placed_yaml_data yaml_data_slice = yaml_data[env] || yaml_data[env.to_s] || yaml_data[env.to_sym] raise( Qonfig::ExposeError, "#{file_path} file does not contain settings with <#{env}> environment key!" ) unless yaml_data_slice raise( Qonfig::IncompatibleYAMLStructureError, 'YAML content should have a hash-like structure' ) unless yaml_data_slice.is_a?(Hash) yaml_based_settings = build_data_set_klass(yaml_data_slice).new.settings settings.__append_settings__(yaml_based_settings) end |