On Tue, Dec 10, 2013 at 7:49 AM, selvag selvag <lists / ruby-forum.com> wrote:
> #!/usr/bin/ruby
> #hash_of_hash.rb
>
> list={"app1"=>101,"app2"=>104,"app3"=>109,"app4"=>123}
>
> h=Hash.new{ |h,id| h[id]=Hash.new{ |h,dt| h[dt]={} }}
> h["company"]["products"]=list
> puts h
>
> # edit this code if you've much easier format than this one.
> # output should be same.

Arbitrary nesting:

1.9.3-p448 :001 > h = Hash.new {|h,k| h[k] = Hash.new(&h.default_proc)}
 => {}
1.9.3-p448 :002 > h[1][2][3][4] = true
 => true
1.9.3-p448 :003 > h
 => {1=>{2=>{3=>{4=>true}}}}

Jesus.