Class: BottomlessHash
Overview
By Nick Ostrovsky firedev.com/posts/2015/bottomless-ruby-hash/
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ BottomlessHash
constructor
A new instance of BottomlessHash.
Methods inherited from Hash
#apply_diff, #apply_diff!, #bottomless, #diff, #except, #grep, #only, #pop, #recursively_symbolize_keys!, #symbolize_keys, #symbolize_keys!, #to_query_string
Constructor Details
#initialize ⇒ BottomlessHash
Returns a new instance of BottomlessHash.
4 5 6 |
# File 'lib/midwire_common/hash.rb', line 4 def initialize super(&-> (hash, key) { hash[key] = self.class.new }) end |
Class Method Details
.from_hash(hash) ⇒ Object
8 9 10 |
# File 'lib/midwire_common/hash.rb', line 8 def self.from_hash(hash) new.merge(hash) end |