Skip to content

Instantly share code, notes, and snippets.

@banister
Created February 16, 2012 09:29
Show Gist options
  • Save banister/20cbbbb092d001d4d1ef to your computer and use it in GitHub Desktop.
Save banister/20cbbbb092d001d4d1ef to your computer and use it in GitHub Desktop.
a = ["a2", "f6", "r1", "a2"]
# => ["a2", "f6", "r1", "a2"]
a.each_with_object({}) do |v, h|
key, value = v.split("")
h[key] = value
end
# => {"a"=>"2", "f"=>"6", "r"=>"1"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment