diff options
Diffstat (limited to 'mrblib/array.rb')
| -rw-r--r-- | mrblib/array.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mrblib/array.rb b/mrblib/array.rb index 5b9ee47c0..a75ed6223 100644 --- a/mrblib/array.rb +++ b/mrblib/array.rb @@ -46,7 +46,12 @@ class Array def collect!(&block) return to_enum :collect! unless block - self.each_index { |idx| self[idx] = block.call(self[idx]) } + idx = 0 + len = size + while idx < len + self[idx] = block.call self[idx] + idx += 1 + end self end |
