Hi --

On Mon, 3 Nov 2008, Brian Candler wrote:

> Thomas Sawyer wrote:
>> Enumerator.new() wants an enumerable object as an argument --what is
>> 1.9 doing without it?
>
> 1.9 supports two completely different types of Enumerator objects. The
> first  is the simple 1.8.6 one which just maps method :each to arbitrary
> method :foo on the upstream object. The second is the clever one.

Although... they're really the same if you think of it as an
enumerable object that has everything it needs except the knowledge of
what to iterate over (i.e., the "each" intelligence), and the block
and the method-attachment are just two different ways of teaching it
how it should iterate.

At least, that's how I'm planning to present it in my book, so I
thought I'd try it out here first :-)


David

-- 
Rails training from David A. Black and Ruby Power and Light:
   Intro to Ruby on Rails  January 12-15   Fort Lauderdale, FL
   Advancing with Rails    January 19-22   Fort Lauderdale, FL *
   * Co-taught with Patrick Ewing!
See http://www.rubypal.com for details and updates!