On Nov 12, 2:31 pm, Martin DeMello <martindeme... / gmail.com> wrote:
> On Nov 12, 2007 11:10 AM,  <furtive.cl... / gmail.com> wrote:
>
>
>
> > This is the first I've heard of Object#tap.  It seems backward because
> > you almost always want the result of the block, not the object back
> > again.
>
> #tap is the opposite use case - you want to "tap" the object stream,
> observing without affecting.

OK I understand Object#tap now.  At first I thought the motivation was
to modify the object inside the block, but now I see that it can be a
useful part of functional-style ruby.

So, to throw this out again --- there should also be Object#as which
returns the block result (I like the name 'as' but I am not
particularly attached to it).  I can personally attest to its
usefulness, and I can show reams of examples in addition to the above
one I gave.