diff options
| author | Christopher Aue <[email protected]> | 2017-07-30 13:19:31 +0200 |
|---|---|---|
| committer | Christopher Aue <[email protected]> | 2017-07-30 13:19:31 +0200 |
| commit | 3359b86ec7284234ae088ab682f82a0603029c34 (patch) | |
| tree | 0e6e5f5dcb967d3a874a4d4f442bc4147818d98c /mrblib/array.rb | |
| parent | c8fdab8725d58375ccdbd9816e48fdb021a199d4 (diff) | |
| download | mruby-3359b86ec7284234ae088ab682f82a0603029c34.tar.gz mruby-3359b86ec7284234ae088ab682f82a0603029c34.zip | |
Improved speed of enumeration methods
Diffstat (limited to 'mrblib/array.rb')
| -rw-r--r-- | mrblib/array.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mrblib/array.rb b/mrblib/array.rb index be98f217e..5b9ee47c0 100644 --- a/mrblib/array.rb +++ b/mrblib/array.rb @@ -11,7 +11,7 @@ class Array # # ISO 15.2.12.5.10 def each(&block) - return to_enum :each unless block_given? + return to_enum :each unless block idx = 0 while idx < length @@ -27,7 +27,7 @@ class Array # # ISO 15.2.12.5.11 def each_index(&block) - return to_enum :each_index unless block_given? + return to_enum :each_index unless block idx = 0 while idx < length @@ -44,7 +44,7 @@ class Array # # ISO 15.2.12.5.7 def collect!(&block) - return to_enum :collect! unless block_given? + return to_enum :collect! unless block self.each_index { |idx| self[idx] = block.call(self[idx]) } self |
