Method: Hash#unshift

Defined in:
lib/bblib/core/util/hash.rb

#unshift(hash, value = nil) ⇒ Object

Like unshift for Arrays. Adds a key to the beginning of a Hash rather than the end.



58
59
60
61
# File 'lib/bblib/core/util/hash.rb', line 58

def unshift(hash, value = nil)
  hash = { hash => value } unless hash.is_a?(Hash)
  replace(hash.merge(self).merge(hash))
end