mergeメソッドについて
2つのハッシュを統合するレシーバhashと引数other_hashのキーと値を集め、新しいハッシュに入れて返す。重複するキーが有るときは、ohter_hashの値が使われます。
image1 = { :src => "monkey.jpg", :alt => "monkey" }
image2 = { :width => 320, :height => 240 }
image3 = image1.merge(image2)
puts image3[:src], image3[:width]
monkey.jpg
320
使い方
hash.merge(other_hash) {|key, oldval, newval| block }