Class: Hashish
Class Method Summary collapse
-
.array ⇒ Object
Return a new hash whose default value is an empty array; i.e.
-
.hash ⇒ Object
Return a new hash whose default value is an empty hash; i.e.
Class Method Details
.array ⇒ Object
Return a new hash whose default value is an empty array; i.e. querying any un-assigned key will assign and return an empty array to that key.
4 5 6 |
# File 'lib/babushka/core_patches/hashish.rb', line 4 def self.array Hash.new {|hsh,k| hsh[k] = [] } end |
.hash ⇒ Object
Return a new hash whose default value is an empty hash; i.e. querying any un-assigned key will assign and return an empty hash to that key. Note that the empty hash is a regular hash and doesn’t have any default keys of its own.
11 12 13 |
# File 'lib/babushka/core_patches/hashish.rb', line 11 def self.hash Hash.new {|hsh,k| hsh[k] = {} } end |