method
merge
v1_9_1_378 -
Show latest stable
- Class:
Hash
merge(p1)public
Returns a new hash containing the contents of other_hash and the contents of hsh, overwriting entries in hsh with duplicate keys with those from other_hash.
h1 = { "a" => 100, "b" => 200 } h2 = { "b" => 254, "c" => 300 } h1.merge(h2) #=> {"a"=>100, "b"=>254, "c"=>300} h1 #=> {"a"=>100, "b"=>200}