From: badboy Date: 2009-01-14T04:10:51+09:00 Subject: Re: Implementing each and <=> Ruby Rabbit schrieb: > 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 each > @list.each { |item| yield item } > end > > def <=>(other) > @list <=> other > end > > (let's just assume that @list is an array) > > Thanks. i would define each like this: def each(&blk) @list.each(&blk) end