Rajinder Yadav wrote:
> Brian thanks for the demonstration of how to use Comparable, and also 
> pointing
> out the other methods that can be redefined. If you didn't mention that, 
> I would
> have stopped at <=>. Although I suspect the other methods make use of 
> <=>
> internally?

That's exactly what Comparable does: these new methods in turn call the 
<=> method that you defined.

In the same way, Enumerable gives you a whole bunch of new methods, 
which in turn make use of 'each' (and only 'each'). So as long as you 
have defined an 'each' method which yields the collection members in 
turn, all the other methods in Enumerable will work.

Regards,

Brian.
-- 
Posted via http://www.ruby-forum.com/.