Skip to content

Instantly share code, notes, and snippets.

@covard
Last active December 17, 2015 04:18
Show Gist options
  • Save covard/5549206 to your computer and use it in GitHub Desktop.
Save covard/5549206 to your computer and use it in GitHub Desktop.
Transform array of hashes into a hash
# how to take an array of hashes and transform it into a hash
ary = [{a: :b}, {c: :d}]
ary.reduce Hash.new, :merge
# output {:a=>:b, :c=>:d}
# Happy Rubying =)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment