Sort an array of hashes in Ruby


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  1. my_arr.sort_by { |my_item| my_item[:my_key] }

URL: http://snippets.dzone.com/posts/show/2470

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.