Sha256: 9d1681c965bfb4a7a51b0f3e4bf27d4fdd1da0609440f3701ba6217f7f066c47
Contents?: true
Size: 585 Bytes
Versions: 1
Compression:
Stored size: 585 Bytes
Contents
class Confrider::Core def initialize(hash) @vault = {} save_hash(nil, hash) end def [](key, default_value = nil) @vault.fetch(key, default_value) end def save(key, value) @vault[key] = value end def save_hash(key, hash) @vault[key] = hash if key hash.each do |inner_key, value| normalized_key = normalize_keys(key, inner_key) case value when Hash then save_hash(normalized_key, value) else save(normalized_key, value) end end end def normalize_keys(*keys) keys.join('.').gsub(/^\./, '') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
confrider-0.0.1 | lib/confrider/core.rb |