2009/11/4 Martin DeMello <martindemello / gmail.com>:
> Also, see this if you want autovivification all the way down:
>
> http://t-a-w.blogspot.com/2006/07/autovivification-in-ruby.html

IMHO this solution is even simpler because it does not need the method:

h = Hash.new {|h,k| h[k] = Hash.new(&h.default_proc)}

irb(main):002:0> h[1][2][3]=4
=> 4
irb(main):003:0> h
=> {1=>{2=>{3=>4}}}

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/