Class: Completely::Config
- Inherits:
-
Object
- Object
- Completely::Config
- Defined in:
- lib/completely/config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #flat_config ⇒ Object
-
#initialize(config) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(config) ⇒ Config
Returns a new instance of Config.
19 20 21 |
# File 'lib/completely/config.rb', line 19 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/completely/config.rb', line 3 def config @config end |
Class Method Details
.load(config_path) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/completely/config.rb', line 6 def load(config_path) begin config = YAML.load_file config_path, aliases: true rescue ArgumentError # :nocov: config = YAML.load_file config_path # :nocov: end new config end |
Instance Method Details
#flat_config ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/completely/config.rb', line 23 def flat_config result = {} config.each do |root_key, root_list| result.merge! process_key(root_key, root_list) end result end |