Skip to content

Instantly share code, notes, and snippets.

@banister
Created February 16, 2012 09:29
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