title: Ruby - Why is this reverse sort not working correctly?
body: <p>I have code that's sorting an array of arrays of objects based on a common method/value all objects share, but it's not quite working correctly. The code is supposed to give me the X highest totals based on the added value, but if I do <code>.first(10)</code> it misses the top values. If I do <code>first(50)</code>, I see more, but there's still some higher values missing. What's going on here, shouldn't my sort and reverse ensure that <code>first(x)</code> will return the array with the highest sum? It seems <code>first</code> is grabbing without the sort being completed.</p>
  
  <pre><code>some_array = old_array.sort_by{ |ar| ar.sum(&amp;:ppd) }.reverse.first(10)
  </code></pre>
  
  <p>Here's an example of what old_array looks like in case it adds clarity</p>
  
  <pre><code>old_array = [
               [ obj1, obj2 ], #obj1.ppd + obj2.ppd = 50
               [ obj3, obj4 ], #sum ppd = 55
               [ obj5, obj6 ], #sum ppd = 60, does not show in first(10)
               ... #and so on with dozens more
              ]
  </code></pre>