mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-array-ext: add parentheses to to_enum calls
added parentheses to all to_enum calls where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -62,7 +62,7 @@ class Array
|
||||
|
||||
# for efficiency
|
||||
def reverse_each(&block)
|
||||
return to_enum :reverse_each unless block
|
||||
return to_enum(:reverse_each) unless block
|
||||
|
||||
i = self.size - 1
|
||||
while i>=0
|
||||
@@ -187,7 +187,7 @@ class Array
|
||||
# scores.delete_if {|score| score < 80 } #=> [97]
|
||||
|
||||
def delete_if(&block)
|
||||
return to_enum :delete_if unless block
|
||||
return to_enum(:delete_if) unless block
|
||||
|
||||
result = []
|
||||
idx = 0
|
||||
@@ -217,7 +217,7 @@ class Array
|
||||
# If no block is given, an Enumerator is returned instead.
|
||||
|
||||
def reject!(&block)
|
||||
return to_enum :reject! unless block
|
||||
return to_enum(:reject!) unless block
|
||||
|
||||
result = []
|
||||
idx = 0
|
||||
@@ -288,7 +288,7 @@ class Array
|
||||
# undefined which value is actually picked up at each iteration.
|
||||
|
||||
def bsearch(&block)
|
||||
return to_enum :bsearch unless block
|
||||
return to_enum(:bsearch) unless block
|
||||
|
||||
if idx = bsearch_index(&block)
|
||||
self[idx]
|
||||
@@ -310,7 +310,7 @@ class Array
|
||||
# element itself. For more details consult the documentation for #bsearch.
|
||||
|
||||
def bsearch_index(&block)
|
||||
return to_enum :bsearch_index unless block
|
||||
return to_enum(:bsearch_index) unless block
|
||||
|
||||
low = 0
|
||||
high = size
|
||||
@@ -360,7 +360,7 @@ class Array
|
||||
# a.keep_if { |val| val > 3 } #=> [4, 5]
|
||||
|
||||
def keep_if(&block)
|
||||
return to_enum :keep_if unless block
|
||||
return to_enum(:keep_if) unless block
|
||||
|
||||
result = []
|
||||
idx = 0
|
||||
@@ -389,7 +389,7 @@ class Array
|
||||
# If no block is given, an Enumerator is returned instead.
|
||||
|
||||
def select!(&block)
|
||||
return to_enum :select! unless block
|
||||
return to_enum(:select!) unless block
|
||||
|
||||
result = []
|
||||
idx = 0
|
||||
|
||||
Reference in New Issue
Block a user