I'm not positive, but I'd imagine that there's an
inferred "self." before the "each" call.

Jason Persampieri
Tools Programmer
Kush Games

--- Greg Millam <walker / deafcode.com> wrote:
> On Wed, 11 Dec 2002, Jake wrote:
> 
> > class Array
> >   def each2
> >     each {|value| puts value}
> >   end
> > end
> > [1, 2, 3].each2
> >
> >
> > **HOW IN THE NAME OF ALAN TURING DOES _each2_ PASS
> _value_ TO
> > _each_***?!?!  I could see how it works if the
> string ".each2" were
> > literally replaced with ".each {|value| puts
> value}" (ala tcl), but
> > everything i think i know about method calls tells
> me that its
> > probably not that simple.
> >
> 
> Here, you've defined 'each2' as a method of class
> 'Array' - 'Array'
> already has 'each' defined, and when you call
> 'each2', it merely calls
> 'each ', also a method of the same array that each2
> is called on.
> 
> >
> > Thanks in advance for your assistance in helping
> me understand ruby!
> > Jake
> >
> 
> --
> Greg Millam
> walker at deafcode.com
> 
>