Skip to content

Instantly share code, notes, and snippets.

@andreaseriksson
Created March 10, 2015 17:45
Show Gist options
  • Save andreaseriksson/8347354a1153fc49f677 to your computer and use it in GitHub Desktop.
Save andreaseriksson/8347354a1153fc49f677 to your computer and use it in GitHub Desktop.
Create hash from array
a = ["a", "b", "c", "d"]
h = Hash[a.map {|x| [x, 1]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment