Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/crazy_doll/fixes.rb

Instance Method Summary collapse

Instance Method Details

#+(other_hash) ⇒ Object

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
10
# File 'lib/crazy_doll/fixes.rb', line 3

def +(other_hash)
  raise ArgumentError, 'hash + hash only' unless other_hash.class == Hash
  new_hash = self.clone
  for key in other_hash.keys
    new_hash[key] = other_hash[key]
  end
  return new_hash
end