Skip to content

Instantly share code, notes, and snippets.

@cato
Created March 23, 2011 00:38
Show Gist options
  • Select an option

  • Save cato/882406 to your computer and use it in GitHub Desktop.

Select an option

Save cato/882406 to your computer and use it in GitHub Desktop.
a = ['abc', 'def', 'ghi']
h = {}
a.each {|i| h[a.index(i).to_s => i}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment