Sha256: 9b270a4ab7b58eba7e0cbede3910b12c6ecaacc447289fe97e288263099a4593
Contents?: true
Size: 658 Bytes
Versions: 2
Compression:
Stored size: 658 Bytes
Contents
module Dsc module Mash class << self DEFAULT_PROC = lambda do |hash, key| raise UndefinedAttribute, "Attribute #{key} is not defined in the config file (current hash: #{hash.inspect})." end def new(source) Hashie::Mash.new(source).tap do |hash| recursively_freeze(hash) end end private def recursively_freeze(object) case object when Array object.each { |obj| recursively_freeze(obj) } when Hash object.default_proc = DEFAULT_PROC recursively_freeze(object.values) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dsc-0.1.0 | lib/dsc/mash.rb |
dsc-0.0.1 | lib/dsc/mash.rb |