Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding the Object#tap method from Ruby 1.9.

  • Loading branch information...
commit 94a9a7be9f6ef8e5768e569fddba6677b952ca17 1 parent f434a99
@jcoglan jcoglan authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 source/core/kernel.js
View
5 source/core/kernel.js
@@ -18,6 +18,11 @@ JS.Kernel = new JS.Module({
var self = this, cache = self.__mcache__ = self.__mcache__ || {};
if ((cache[name] || {}).fn === self[name]) return cache[name].bd;
return (cache[name] = {fn: self[name], bd: JS.bind(self[name], self)}).bd;
+ },
+
+ tap: function(block, scope) {
+ block.call(scope || null, this);
+ return this;
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.