title: Sorting of array of hash
body: <p>I have an array of hash, sorting by particular key not properly working,</p>
  
  <p>The array of hash is:</p>
  
  <pre><code>@final_array = [{:Region=&gt;"region - 1", :ItemSize=&gt;"Box", :Price=&gt;""}, {:Region=&gt;"region - 1", :ItemSize=&gt;"Pack", :Price=&gt;""}, {:Region=&gt;"region - 1", :ItemSize=&gt;"ball", :Price=&gt;""}, {:Region=&gt;"region - 1", :ItemSize=&gt;"ball -1", :Price=&gt;""}, {:Region=&gt;"region - 1", :ItemSize=&gt;"new size", :Price=&gt;""}, {:Region=&gt;"region - 1", :ItemSize=&gt;"new size 1", :Price=&gt;""}, {:Region=&gt;"region - 1", :ItemSize=&gt;"wels", :Price=&gt;""}]
  
  @final_array = @final_array.sort_by { |x, y| x[:ItemSize] }
  </code></pre>
  
  <p>After sorting I am checking array by select query.</p>
  
  <pre><code>a = []
  
  @final_array.select{ |x, y| a &lt;&lt; x[:ItemSize] }
  
  a
  # =&gt; ["Box", "Pack", "ball", "ball -1", "new size", "new size 1", "wels"]
  </code></pre>
  
  <p>It's not properly working.</p>
  
  <p>How do I solve this problem?</p>