Class: BottomlessHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/midwire_common/hash.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

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

#initializeBottomlessHash

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