Skip to content

Instantly share code, notes, and snippets.

@dasibre
Created September 6, 2013 18:45
Show Gist options
  • Save dasibre/6468189 to your computer and use it in GitHub Desktop.
Save dasibre/6468189 to your computer and use it in GitHub Desktop.
array inject method
hash = [[:first_name, 'Shane'], [:last_name, 'Harvie']].inject({}) do |result, element|
result[element.first] = element.last
result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment