I have an array of hashes:
a=[{ \'foo\'=>0,\'bar\'=>1 }, { \'foo\'=>0,\'bar\'=>2 }, ... ]
I want to sort the array first
consider compacting the array (removing nil entries), and as a bonus, if it's string comparision, downcase the values for case insensitive sorting.
a.compact.sort_by { |h| [h['foo'].downcase, h['bar'].downcase] }