On Feb 11, 9:09 pm, Norbert Melzer <timmel...@googlemail.com> wrote: > Hello everybody! > > I have a problem with an Hash of Arrays. > > ruby-1.9.2-p136 :001 > x = Hash.new Array.new > => {} > ruby-1.9.2-p136 :002 > x["test"] << "test" > => ["test"] > ruby-1.9.2-p136 :003 > x > => {} > ruby-1.9.2-p136 :004 > x.keys > => [] > ruby-1.9.2-p136 :005 > x["test"] > => ["test"] > ruby-1.9.2-p136 :006 > > > Why is keys empty? > because you've never actually done x["test"]= ... (all you're doing is modifying the hash's default value)
Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.