Created
June 3, 2011 20:24
-
-
Save cyakimov/1007096 to your computer and use it in GitHub Desktop.
Array to Hash in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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