Skip to content

Instantly share code, notes, and snippets.

@andycamp
Created September 14, 2012 11:26
Show Gist options
  • Select an option

  • Save andycamp/3721401 to your computer and use it in GitHub Desktop.

Select an option

Save andycamp/3721401 to your computer and use it in GitHub Desktop.
Hash From Two Equivalent Arrays
a = ["one","two","three"]
b = ["un", "du", "trois"]
c = Hash[a.zip(b)]
puts c
# => {"one"=>"un", "three"=>"trois", "two"=>"du"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment