On Sep 18, 6:08 pm, John Do <[EMAIL PROTECTED]> wrote:
> Erol Fornoles wrote:
> > On Sep 18, 3:08 pm, Frederick Cheung <[EMAIL PROTECTED]>
> > wrote:
>
> 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.
>
hash = Hash.new {|h,k| h[k]=Hash.new &h.default_proc}

Mwahahahahaha

Fred

> 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 viahttp://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to