Convert two Arrays into one Hash (Ruby)
The returned hash will have the same quantity of elements that the first(self) array.
class Array
def merge_into_hash(anArray)
tmp,hash = anArray.dup,{}
self.each {|key| hash[key] = tmp.shift}
hash
end
end
DZone Snippets > jmrepetti > into
11391 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world