From: "David A. Black" Date: 2010-07-23T02:34:12+09:00 Subject: Re: Enumerators and generators Hi -- On Fri, 23 Jul 2010, Hal Fulton wrote: > My next questions then are: > > 1. Does Enumerator::Generator have all the functionality of the > old generator.rb, just (it seems to me) a different usage? No; it doesn't have #next or #rewind, but enumerators (which can easily/transparently wrap generators) do. Neither of them appears to have #pos, unless it's available in some other way that I haven't spotted. (I'm writing this in haste and without benefit of irb, so I'm not digging further right now.) > 2. In David's example, is "yielder" simply an array of objects? Do > we know or care? (If so, I'd be tempted to call it "list" because > "yielder" reminds of the keyword yield which I suppose is unrelated > here.) It's actually an Enumerator::Yielder object, which I think only exists for the purpose of being the receptacle for the objects to be yielded by the generator. David -- David A. Black, Senior Developer, Cyrus Innovation Inc. The Ruby training with Black/Brown/McAnally Compleat Philadelphia, PA, October 1-2, 2010 Rubyist http://www.compleatrubyist.com