Ruby Hash par défaut Proc
layers = Hash.new do |layers, layer_name|
layers[layer_name] = Hash.new(&layers.default_proc)
end
layers[:layer_1][:layer_2][:layer_3] = 'a secret'
layers # => { layer_1: { layer_2: { layers_3: 'a secret' } } }
patrick204nqh