たとえば、こんな2つのハッシュがあるとする。
smart_phones = { apple: :iphone, google: :pixel, samsung: :galaxy, } other_smart_phones = { huawei: :p30, sharpe: :aquos }
これらのハッシュをがっちゃんこしたい場合、merge
メソッドを使える。
puts smart_phones.merge(other_smart_phones) #結果 {:apple=>:iphone, :google=>:pixel, :samsung=>:galaxy, :huawei=>:p30, :sharpe=>:aquos}