Merge pull request #648 from RyanScottLewis/master

Slightly faster Array#each method.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2012-12-19 03:40:24 -08:00
+3 -5
View File
@@ -10,11 +10,9 @@ class Array
#
# ISO 15.2.12.5.10
def each(&block)
idx = 0
while(idx < length)
block.call(self[idx])
idx += 1
end
idx, length = -1, self.length-1
block.call(self[idx += 1]) while(idx < length)
self
end