Daniel Sheppard
10/15/2007 7:34:00 AM
> is it possible to reverse order when using a Time as sort key
> for sort_by?
>
> I know I could use sort, and time2 <=> time1, but it's getting
> complicated when the sort key is compound, like
>
> sort_by{|e| [e.name, e.time]}
For your special case of using time as a sort key, just convert the time
to an integer
sort_by {|e| [e.name, -e.time.to_i] }
Dan.