title: Retrieve some elements of a hash inside an array
body: <p>I have an array of hashes <code>myhash</code>:</p>
  
  <pre><code>myhash
  =&gt; [{"product_id"=&gt;"1", "test"=&gt;"2", "retest"=&gt;"42"}, {"product_id"=&gt;"1", "test"=&gt;"2", "retest"=&gt;"42"}]
  </code></pre>
  
  <p>I want to map the hashes to their value for <code>product_id</code>. I did this:</p>
  
  <pre><code>myhash.map{|item| item['product_id']}
  # =&gt; ["1", "1"]
  </code></pre>
  
  <p>which gives what I want.</p>
  
  <p>Is there anyway to make it nicer using a map proc? I tried <code>myhash.map(&amp;:fetch('product_id'))</code>, but to no avail.</p>
  
  <p><strong>Edit:</strong> In other words, I resumed the situation thanks to @7stud who tried to answer:</p>
  
  <pre><code>a.map(&amp;:"fetch('product_id')")
  =&gt; NoMethodError: undefined method `fetch('product_id')' for {"product_id"=&gt;"1", "test"=&gt;"2", "retest"=&gt;"42"}:Hash
       from (irb):5:in `map'
       from (irb):5
       from /home/shideneyu/.rbenv/versions/1.9.3-p194/bin/irb:12:in `&lt;main&gt;'
  </code></pre>
  
  <p>Or, when I do this:</p>
  
  <pre><code>{"product_id"=&gt;"1", "test"=&gt;"2", "retest"=&gt;"42"}.fetch('product_id')
  =&gt; "1"
  </code></pre>
  
  <p>It retrieves the good value. The issue then is that I can't pass a param to the <code>fetch</code> method while using the map. How to do so?</p>