Module: ConfigVolumizer
- Defined in:
- lib/config_volumizer.rb,
lib/config_volumizer/parser.rb,
lib/config_volumizer/version.rb,
lib/config_volumizer/generator.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.3.1"
Class Method Summary collapse
-
.fetch(source, mapping_key, mapping_info, default = nil, &block) ⇒ Object
Fetches the data described by the mapping from the source works similar to #parse, but has a default value mechanism and skips the root key.
-
.generate(data) ⇒ Hash
Generates a flattened config out of a data hash.
-
.parse(source, mapping) ⇒ Hash
Parses keys within the source hash matching base_name returning a hash with all the matched data under a string key matching the base_name.
Class Method Details
.fetch(source, mapping_key, mapping_info, default = nil, &block) ⇒ Object
Fetches the data described by the mapping from the source works similar to #parse, but has a default value mechanism and skips the root key
30 31 32 33 |
# File 'lib/config_volumizer.rb', line 30 def fetch(source, mapping_key, mapping_info, default=nil, &block) value = Parser.parse(source, mapping_key => mapping_info) value.fetch(mapping_key, *[default].compact, &block) end |