For example, I have array of single hashes
a = [{a: :b}, {c: :d}]
What is best way to convert it into this?
{a: :b, c: :d}
You can transform it to array [[:a, :b]] and after that translate everything to hash {:a=>:b}
[[:a, :b]]
{:a=>:b}
# it works like [[:a, :b]].to_h => {:a=>:b} [{a: :b}, {c: :d}].map { |hash| hash.to_a.flatten }.to_h # => {:a=>:b, :c=>:d}