title: ruby: use hash as default value of another hash?
body: <p>I want to use a hash as a bigger hash's default value. But I don't know how to set the inner hash's value through the outer hash.</p>
  
  <pre><code>h = Hash.new do 
    {:counter =&gt; 0}
  end
  h[:a][:counter] += 1
  =&gt; 1 
  h[:a][:counter] += 1
  =&gt; 1
  h[:a][:counter] += 1
  =&gt; 1 
  h
  =&gt; {}
  </code></pre>
  
  <p>Uh, what's the right way?</p>