title: Inject not working as expected
body: <p>Can anybody explain why these two snippets of code are not equivalent? Either I am missing something or inject does not do what I think it does. Given:</p>
  
  <pre><code>nodes = [{id: 1}, {id: 2}]
  </code></pre>
  
  <p>This code:</p>
  
  <pre><code>result = Hash.new
  nodes.each do |node|
    result[node[:id]] = node.inspect
  end
  result
  </code></pre>
  
  <p>returns </p>
  
  <pre><code> {
    1 =&gt; "{:id=&gt;1}",
    2 =&gt; "{:id=&gt;2}"
  }
  </code></pre>
  
  <p>But this:</p>
  
  <pre><code>nodes.inject({}) {|hash, node|hash[node[:id]] = node.inspect}
  </code></pre>
  
  <p>returns:</p>
  
  <pre><code>"{:id=&gt;2}"
  </code></pre>
  
  <p>Why?</p>