From: Ruby Rabbit Date: 2009-01-14T05:30:20+09:00 Subject: Re: Implementing each and <=> Dave Thomas wrote: > On Jan 13, 2009, at 1:08 PM, Ruby Rabbit wrote: > >> I have a data model and would like to let it be Enumerable. I want to >> confirm if this is the way of implementing each and <=> : > >> ... > >> def <=>(other) >> @list <=> other >> end > > <=> would normally apply to items in your list, not to the container > itself. That's whats confusing me. How would i put it? I am putting in the <=> so this class might be more useful to others. I haven't got around to using it myself. (I have a base class ListDataModel with minimal methods and wanted to make it as useful as possible). -- Posted via http://www.ruby-forum.com/.