2009年8月22日土曜日

Hash.new

x = Hash.new{|h,k| h[k]=Hash.new(&h.default_proc)}
とすると、
x[:a]=1
とか、
x[:b][:c]=2
とか、やれるみたい。便利。

0 件のコメント:

コメントを投稿