Class: Qonfig::Commands::Definition::LoadFromYAML Private
- Defined in:
- lib/qonfig/commands/definition/load_from_yaml.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
- #file_path ⇒ String, Pathname readonly private
- #strict ⇒ Boolean readonly private
Instance Method Summary collapse
- #call(data_set, settings) ⇒ void private
-
#initialize(file_path, strict: true) ⇒ LoadFromYAML
constructor
private
A new instance of LoadFromYAML.
Methods inherited from Base
inheritable=, inheritable?, #inheritable?, inherited
Constructor Details
#initialize(file_path, strict: true) ⇒ LoadFromYAML
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 LoadFromYAML.
26 27 28 29 |
# File 'lib/qonfig/commands/definition/load_from_yaml.rb', line 26 def initialize(file_path, strict: true) @file_path = file_path @strict = strict end |
Instance Attribute Details
#file_path ⇒ String, Pathname (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.
13 14 15 |
# File 'lib/qonfig/commands/definition/load_from_yaml.rb', line 13 def file_path @file_path end |
#strict ⇒ Boolean (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.
19 20 21 |
# File 'lib/qonfig/commands/definition/load_from_yaml.rb', line 19 def strict @strict 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.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/qonfig/commands/definition/load_from_yaml.rb', line 39 def call(data_set, settings) yaml_data = Qonfig::Loaders::YAML.load_file(file_path, fail_on_unexist: strict) raise( Qonfig::IncompatibleYAMLStructureError, 'YAML content must be a hash-like structure' ) unless yaml_data.is_a?(Hash) yaml_based_settings = build_data_set_klass(yaml_data).new.settings settings.__append_settings__(yaml_based_settings) end |