Created
July 17, 2009 14:49
-
-
Save bluescreen303/149088 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RubyArray = new JS.Class({ | |
include: JS.Enumerable, | |
initialize: function(ary) { | |
this._ary = ary; | |
}, | |
forEach: function(block, context) { | |
if (!block) return this.enumFor('forEach'); | |
for (var i = 0, n = this._ary.length; i < n; i++) | |
block.call(context || null, this._ary[i]); | |
return this; | |
}, | |
// plus Array-specific methods | |
}); | |
var a = new RubyArray([1,2,3,5]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment