Skip to content

Instantly share code, notes, and snippets.

@kitofr
Created February 27, 2011 22:42
Show Gist options
  • Save kitofr/846647 to your computer and use it in GitHub Desktop.
Save kitofr/846647 to your computer and use it in GitHub Desktop.
Merge 2 arrays into a single hash
([:a, :b, :c].zip([1,2,3])).inject({}){|res, ele| res[ele.first] = ele.last; res} #=> {:c=>3, :a=>1, :b=>2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment