Possible Duplicate:
Sorting an array in descending order in Ruby

I want to sort an array of elements based on some condition, except in reverse order. So basically whatever it would have done and then reversed.

So for example I have an array of strings and I want to sort it by decreasing string length

a = ["test", "test2", "s"]
a.sort_by!{|str| str.length}.reverse!

While this does the job...is there a way to specify the condition such that the sorting algorithm will do it in reverse?

Edit
Report