Class: Hashish

Inherits:
Object show all
Defined in:
lib/babushka/core_patches/hashish.rb

Class Method Summary collapse

Class Method Details

.arrayObject

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
7
# File 'lib/babushka/core_patches/hashish.rb', line 4

def self.array
  Babushka::LogHelpers.deprecated! '2017-09-01', instead: "`Hash.new {|hsh,k| hsh[k] = [] }`"
  Hash.new {|hsh,k| hsh[k] = [] }
end

.hashObject

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.


12
13
14
15
# File 'lib/babushka/core_patches/hashish.rb', line 12

def self.hash
  Babushka::LogHelpers.deprecated! '2017-09-01', instead: "`Hash.new {|hsh,k| hsh[k] = {} }`"
  Hash.new {|hsh,k| hsh[k] = {} }
end