commit 9181c1e5636edf86958ba61b2143e93d6fd5498d
parent 0746918f33ef248b89802294bf9bed0f2604ac64
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date: Wed, 3 Mar 2010 20:08:50 -0800
Object#tap backport
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/sup/util.rb b/lib/sup/util.rb
@@ -132,6 +132,10 @@ class Object
## "k combinator"
def returning x; yield x; x; end
+ unless method_defined? :tap
+ def tap; yield self; self; end
+ end
+
## clone of java-style whole-method synchronization
## assumes a @mutex variable
## TODO: clean up, try harder to avoid namespace collisions