diff options
Diffstat (limited to 'mrblib/array.rb')
| -rw-r--r-- | mrblib/array.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mrblib/array.rb b/mrblib/array.rb index 3c4e2dd76..56bf5ceb2 100644 --- a/mrblib/array.rb +++ b/mrblib/array.rb @@ -11,8 +11,14 @@ class Array # ISO 15.2.12.5.10 def each(&block) idx, length = -1, self.length-1 - while(idx < length) - block.call(self[idx += 1]) + 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 + break + end + end + block.call(elm) end self end |
