2007/12/2, MonkeeSage <MonkeeSage / gmail.com>:
> On Dec 2, 12:20 am, Paul Private <paulus4... / gmail.com> wrote:
> > THanks Jordan
> > this was exactly what I was looking for
> >
> > Paul
>
> Hi Paul,
>
> Glad to help. One more thing: it would probably look nicer to hide
> that behind <=>
>
> class Cursus
>   ...
>   def <=>(other)
>     self.to_s <=> other.to_s
>   end
> end
>
> ...then you can call cursussen.sort w/o the block.

Just a few picky remarks. :-)  Sorting on the string representation,
while it may work, is unstable.  It's better to sort based on members
because with your approach you create a dependency between to_s and
sorting which is neither necessary nor obvious.

Also, I would only implement this in the class if it is the /default/
order for instances of Cursus.

Kind regards

robert

-- 
use.inject do |as, often| as.you_can - without end