title: How should I use each_with_object on Hashes?
body: <p>I would like to use <code>each_with_object</code> on a hash but can't figure out how I should use it. Here is what I have:</p>
  
  <pre><code>hash = {key1: :value1, key2: :value2}
  hash.each_with_object([]) { |k, v, array| array &lt;&lt; k }
  
  NoMethodError: undefined method `&lt;&lt;' for nil:NilClass
  </code></pre>
  
  <p>Is it possible to use <code>each_with_object</code> on hashes? If yes, what is the syntax?</p>