From: Harry Ohlsen Date: 2003-08-07T12:07:18+09:00 Subject: Re: What's New and Shiny in Ruby 1.8.0? Jason Creighton wrote: > BTW, your original example worked fine on my version of Ruby. Another > option, of course, is to implement <=> for Person like so (untested) > > class Person > def <=>(other) > [ @last_name, @first_name ] <=> [ other.last_name, other.first_name ] > end > end That's probably something one should do, anyway. Ie, define the logical default ordering for objects of that type. The thing I like about the sort_by approach is that it allows you to easily change the ordering on the fly. It's also just such a nice example of POLS! H.