From: dblack@... Date: 2006-11-17T20:58:59+09:00 Subject: Re: #returning and #tap Hi -- On Fri, 17 Nov 2006, spooq wrote: > On 11/17/06, Martin DeMello wrote: >> On 11/17/06, spooq wrote: >> > Actually, how about giving the proc a copy of the object, rather than >> > the real deal? >> > >> > class Object >> > def tap >> > yield self.dup >> > self >> > end >> > end >> >> Thought of that, but not everything responds to dup (nil and symbols, e.g.) > > Can those cases be worked around? I don't think dup'ing plays well with the intent, which is to do a kind of pass-through of the object itself. David -- David A. Black | dblack@rubypal.com Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org