Robert Klemme
6/18/2008 9:53:00 AM
On 18 Jun., 08:35, "David A. Black" <dbl...@rubypal.com> wrote:
> On Wed, 18 Jun 2008, Chance Dinkins wrote:
> > Thanks guys, I apperciate it - these.. dynamic methods (is that what
> > they are considered?) are a little strange to me.
>
> The methods that expect a code block as part of the method call are
> iterators. Basically the code block is a piece of executable code that
> you're making available to be called from the method itself.
> Typically, that means that a method will fire the code block once for
> each element in a collection object like an array.
Yes, but not in all cases. The presence of the block does not tell
you anything about the frequency of invocation. Just think about
File.open for example. So I'd say the general statement "The methods
that expect a code block as part of the method call are iterators" is
misleading.
Kind regards
robert