title: How to return a hash after using sort_by in ruby?
body: <p>When I use <code>sort_by</code> on the frequency hash, it returns an array.  How do I return a hash instead?</p>
  
  <pre><code>puts frequency.class        #returns hash
  frequency = frequency.sort_by {|k,v| v}.reverse
  puts frequency.class        #returns array
  </code></pre>