From: Robert Klemme Date: 2007-05-22T00:55:03+09:00 Subject: Re: using Enumerable when each has arguments? On 21.05.2007 17:51, Trans wrote: > > On May 21, 10:35 am, Robert Klemme wrote: > >>> An alternative is to use a functor (a function delegator) for your >>> parameters, eg. >>> f = Foo.new >>> f.range(1,5).each{|x| p x} >> ... which is basically the same as using to_enum - only less portable; >> to_enum works with *all* methods. :-) > > That true. But at least it reads much better. Even that is subjective: I personally prefer to read f.to_enum(:range, 1, 5) because then I know this is going to be capable of all the Enumerable methods. YMMD though. :-) Kind regards robert