module ConfigVolumizer

Constants

VERSION

Public Class Methods

fetch(source, mapping_key, mapping_info, default=nil, &block) click to toggle source

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

@param [Hash] source @param [String] mapping_key @param [Object] mapping_info @param [Object] default - default value if key not found @param [proc] block - default value proc (is passed key as parameter) @return [Object]

# 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
generate(data) click to toggle source

Generates a flattened config out of a data hash

@see ConfigVolumizer::Generator.generate

@param [Hash] data @return [Hash]

# File lib/config_volumizer.rb, line 41
def generate(data)
  Generator.generate(data)
end
parse(source, mapping) click to toggle source

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}

@see ConfigVolumizer::Parser.parse

@param [Hash] source @param [Hash] mapping @return [Hash]

# File lib/config_volumizer.rb, line 16
def parse(source, mapping)
  Parser.parse(source, mapping)
end