Combine some complex hashes in a ruby
I would like to combine the following hashes together.
h1 = {"201201" => {:received => 2}, "201202" => {:received => 4 }}
h2 = {"201201" => {:closed => 1}, "201202" => {:closed => 1 }}
in particular, my expected result:
h1 = {"201201" => {:received => 2, :closed => 1}, "201202" => {:received => 4, :closed => 1 }}
I tried everything like:
h = h1.merge(h2){|key, first, second| {first , second} }
Unfortunately, nothing seemed suitable to me. Any advice would be really appreciated.
+3