From: "Matthias Wächter" Date: 2007-09-04T16:53:08+09:00 Subject: Re: with On 04.09.2007 09:47, Michael Fellinger wrote: > On 9/4/07, Nobuyoshi Nakada wrote: >> "tap" in 1.9 is same. Great to hear that this is really not available yet :) and I'm not the only one thinking it should be! > They have different effects, while 'tap' will return self and throw > away results of the block, 'with' returns the result of the block. > > [manveru@pi ~]$ RUBYOPT= irb19 > class Object > def with > yield(self) > end > end > # nil > 1.tap{|e| e + 1} + 2 > # 3 > 1.with{|e| e + 1} + 2 > # 4 So it's like .with == .single-map, .tap == .single-each Right? - Matthias