mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
avoid block_given? in enum.rb to reduce method calls
This commit is contained in:
+3
-3
@@ -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|
|
||||
|
||||
Reference in New Issue
Block a user