Skip to content

Instantly share code, notes, and snippets.

@cyakimov
Created June 3, 2011 20:24
Show Gist options
  • Save cyakimov/1007096 to your computer and use it in GitHub Desktop.
Save cyakimov/1007096 to your computer and use it in GitHub Desktop.
Array to Hash in Ruby
#Create a hash like {1=>2, 3=>4} from Array of values
arr = [1,2,3,4]
hash = Hash[*arr]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment