title: How to group and sum arrays in Ruby?
body: <p>I have an array of arrays like this:</p>
  
  <pre><code>ar = [[5, "2014-01-27"],
  [20, "2014-01-28"],
  [5, "2014-01-28"],
  [10, "2014-01-28"],
  [15, "2014-01-29"],
  [5, "2014-01-29"],
  [5, "2014-01-30"],
  [10, "2014-01-30"],
  [5, "2014-01-30"]]
  </code></pre>
  
  <p>What I ultimately need to do is group the array items by date and sum up the numbers in the first item of each sub-array.</p>
  
  <p>So output would be something like:</p>
  
  <pre><code>[[5, "2014-01-27"],
  [35, "2014-01-28"],
  [20, "2014-01-29"],
  [20, "2014-01-30"]]
  </code></pre>