title: Ruby: How to group a Ruby array?
body: <p>I have a Ruby array</p>
  
  <pre><code>&gt; list = Request.find_all_by_artist("Metallica").map(&amp;:song)
  =&gt; ["Nothing else Matters", "Enter sandman", "Enter Sandman", "Master of Puppets", "Master of Puppets", "Master of Puppets"]
  </code></pre>
  
  <p>and I want a list with the counts like this:</p>
  
  <pre><code>{"Nothing Else Matters" =&gt; 1,
   "Enter Sandman" =&gt; 2,
   "Master of Puppets" =&gt; 3}
  </code></pre>
  
  <p>So ideally I want a hash that will give me the count and notice how I have <code>Enter Sandman</code> and <code>enter sandman</code> so I need it case insensitive. I am pretty sure I can loop through it but is there a cleaner way?</p>