in reply to Re^2: Honest question about Perl, Python and Ruby (autovivification)
in thread Honest question about Perl, Python and Ruby
You can autovivify in Ruby with my XKeys Gem.
require 'xkeys' z = [].extend XKeys::Auto z[0, 8] = z[1, 11] = ... = z[1, 4] = 'o'
And
node_info = {}.extend XKeys::Auto node_info['list', :[], 'name'] = 'new node' # :[] means next index # {"list"=>[{"name"=>"new node"}]}
|
---|