Phrogz
10/17/2007 3:58:00 PM
On Oct 17, 9:45 am, Earle Clubb <ecl...@valcom.com> wrote:
> I have a hash where the values are nested arrays. I'd like to be able to
> iterate over the hash and have 3 vars available in the block: key,
> value[0], and value[1]. As you can see, h.each {|a,b,c|...} doesn't
> work.
Not much better, but:
irb(main):006:0> h = { :a => [:foo, :bar] }
=> {:a=>[:foo, :bar]}
irb(main):007:0> h.each{ |key,pair| a,b = *pair; p key, a, b }
:a
:foo
:bar