check if array expands in each block

This commit is contained in:
Yukihiro Matz Matsumoto
2013-01-16 18:35:25 +09:00
parent 79d38c4962
commit 5166aa726d
+1 -1
View File
@@ -11,7 +11,7 @@ class Array
# ISO 15.2.12.5.10
def each(&block)
idx, length = -1, self.length-1
while(idx < length)
while idx < length and length < self.length and length = self.length-1
elm = self[idx += 1]
unless elm
if elm == nil and length >= self.length