Class: Cockroach::Config::Loader
- Inherits:
-
Object
- Object
- Cockroach::Config::Loader
- Defined in:
- lib/cockroach/config/loader.rb
Constant Summary collapse
- CONSTRAINTS =
%w(fixture_gem fixtures_path).freeze
Class Method Summary collapse
-
.parse(path_to_config) ⇒ Object
Load the file from the provided path, and return the contents as an Array, with the following structure:.
Class Method Details
.parse(path_to_config) ⇒ Object
Load the file from the provided path, and return the contents as an Array, with the following structure:
[
{ * Hash containg the amounts },
{ * Hash containing any other options or settings }
]
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cockroach/config/loader.rb', line 22 def parse path_to_config raise ConfigNotExistsError.new("File under the path \"#{path_to_config}\", does not exists.") unless File.exists?(path_to_config) contents = YAML.load_file path_to_config = contents.extract!(*CONSTRAINTS) .delete_if {|key, value| value == nil } = nil if .blank? [contents, ] end |