merge multiple hashes in an array ruby code example
Example 1: ruby merge array of hashes into one hash
a.inject(:merge)
#=> {:a=>:b, :c=>:d}
Example 2: ruby merge array of hashes into one hash
a.reduce Hash.new, :merge
a.inject(:merge)
#=> {:a=>:b, :c=>:d}
a.reduce Hash.new, :merge