Erol Fornoles wrote: > On Sep 18, 3:08�pm, Frederick Cheung <[EMAIL PROTECTED]> > wrote: >> why not just hashx[key1][key3]=key1val3 ? You don't need all those >> intermediate steps. >> >> Fred > > Maybe he's dealing with really large hashes - or just many operations > on them - that having to reference the first sub-hash via the parent > hash every time would give a significant degradation in performance. I > still prefer the approach you mentioned, though.
hashx[key1][key3] = key1val3 will give an error if hashx[key1] is null. This is how I did it in perl, but ruby isn't as forgiving. Also, I want to be able to build an arbitrarily deep hash. Say hashx[key1][key11][key111]...[key11111]. The end goal is to build a hash that I can build an YUI treeview on. So I need to build the tree, then loop through the keys to create the TreeNode. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

