diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-07-31 07:26:46 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-07-31 07:26:46 +0900 |
| commit | facf5f99d4a37e42a54f795cee798a1c555c7cf4 (patch) | |
| tree | 0e6e5f5dcb967d3a874a4d4f442bc4147818d98c /mrblib/array.rb | |
| parent | c8fdab8725d58375ccdbd9816e48fdb021a199d4 (diff) | |
| parent | 3359b86ec7284234ae088ab682f82a0603029c34 (diff) | |
| download | mruby-facf5f99d4a37e42a54f795cee798a1c555c7cf4.tar.gz mruby-facf5f99d4a37e42a54f795cee798a1c555c7cf4.zip | |
Merge pull request #3758 from christopheraue/enumeration_perf
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 |
