On 21.05.2007 19:42, Erwin Abbott wrote:
> Thanks for the replies.  I hadn't looked at Enumerator before, I think
> that will do the trick. I kind of agree it's not the prettiest looking
> code, but I'll write my own #map, #to_a, etc and won't have to look at
> it again.

No, the point is that with Enumerator you do *not* have to write your 
own #map etc.  Just create a method that will iterate - whatever name - 
and then *any* client can do

obj.to_enum(:your_iterator_method, arg1, arg2).map {|item| item.to_s}

(see my first posting to the thread)

>> I heard rumor that a future Ruby will ultimately pass thru each
>> parameters, but in the mean time you can have a go with Facets
>> enumerablepass.rb (http://facets.rubyforge.org).
> 
> I'll look into that too... I see quite a lot of people using facets in
> the code and have been meaning to check it out.  It seems like passing
> parameters along would've been easy and very useful, I'm sort of
> surprised it's not already that way.

But then again, #each probably needs arguments less often than you might 
think right now.

Kind regards

	robert


PS: Please do not top post.  Thank you!