Method: Multimap#merge

Defined in:
lib/multimap.rb

#merge(other) ⇒ Object

call-seq:

map.merge(other_map) => multimap

Returns a new multimap containing the contents of other_map and the contents of map.

map1 = Multimap["a" => 100, "b" => 200]
map2 = Multimap["a" => 254, "c" => 300]
map2.merge(map2) #=> Multimap["a" => 100, "b" => [200, 254], "c" => 300]
map1             #=> Multimap["a" => 100, "b" => 200]


428
429
430
# File 'lib/multimap.rb', line 428

def merge(other)
  dup.update(other)
end