small refactoring for Array#each

This commit is contained in:
Yukihiro Matz Matsumoto
2012-12-19 20:41:41 +09:00
parent 1184efe62b
commit 55870e4b82
+3 -2
View File
@@ -11,8 +11,9 @@ class Array
# ISO 15.2.12.5.10
def each(&block)
idx, length = -1, self.length-1
block.call(self[idx += 1]) while(idx < length)
while(idx < length)
block.call(self[idx += 1])
end
self
end