Why is this Ruby 1.9 code resulting in an empty hash?
Posted
by randombits
on Stack Overflow
See other posts from Stack Overflow
or by randombits
Published on 2010-05-06T00:32:54Z
Indexed on
2010/05/06
0:38 UTC
Read the original article
Hit count: 182
ruby
I'm trying to zip 3 arrays into a hash. The hash is coming up empty, though. Here's sample code to reproduce using Ruby 1.9:
>> foo0 = ["a"]
=> ["a"]
>> foo1 = ["b"]
=> ["b"]
>> foo2 = ["c"]
=> ["c"]
>> h = Hash[foo0.zip(foo1, foo2)]
=> {}
© Stack Overflow or respective owner