diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-12-25 15:59:22 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-12-25 15:59:22 +0900 |
| commit | ef3bbd2e647c92b5a96c04c78a71c9bb41bea679 (patch) | |
| tree | 026a29aac281dfeb81fb7efa0bdb384d6923b4e7 /mrblib/enum.rb | |
| parent | 6eeaef705d9393c42ab7372c11c5d5be4844d4c1 (diff) | |
| download | mruby-ef3bbd2e647c92b5a96c04c78a71c9bb41bea679.tar.gz mruby-ef3bbd2e647c92b5a96c04c78a71c9bb41bea679.zip | |
avoid block_given? in enum.rb to reduce method calls
Diffstat (limited to 'mrblib/enum.rb')
| -rw-r--r-- | mrblib/enum.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mrblib/enum.rb b/mrblib/enum.rb index 41fd97fe7..6bf219283 100644 --- a/mrblib/enum.rb +++ b/mrblib/enum.rb @@ -72,7 +72,7 @@ module Enumerable # # ISO 15.3.2.2.3 def collect(&block) - return to_enum :collect unless block_given? + return to_enum :collect unless block ary = [] self.each{|*val| @@ -108,7 +108,7 @@ module Enumerable # # ISO 15.3.2.2.5 def each_with_index(&block) - return to_enum :each_with_index unless block_given? + return to_enum :each_with_index unless block i = 0 self.each{|*val| @@ -146,7 +146,7 @@ module Enumerable # # ISO 15.3.2.2.8 def find_all(&block) - return to_enum :find_all unless block_given? + return to_enum :find_all unless block ary = [] self.each{|*val| |
