From: spooq Date: 2006-11-17T21:05:07+09:00 Subject: Re: #returning and #tap > I don't think dup'ing plays well with the intent, which is to do a > kind of pass-through of the object itself. The original object -is- getting passed through... the point is to prevent modification of it. That's what map! and each are for. class Object def tap yield self.dup self end end class NilClass def tap yield nil nil end end class Fixnum def tap yield self self end end class Symbol def tap yield self self end end ["abc", nil, 1, :foo].each { |e| e.tap { |p| puts p } } Any other corner cases need fixing?