diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-08-10 22:18:54 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-08-10 22:18:54 +0900 |
| commit | 9f18aced9f4d3c39ba6a5e10c6856c7fc9009714 (patch) | |
| tree | 43b3d9133db30b124058447edcfa1a6750ce1695 | |
| parent | 496a2c3264aa3a2dbc50bb01e545ed4803718213 (diff) | |
| download | mruby-9f18aced9f4d3c39ba6a5e10c6856c7fc9009714.tar.gz mruby-9f18aced9f4d3c39ba6a5e10c6856c7fc9009714.zip | |
`Enumerable#reject`, etc. should return `Enumerable` without block
| -rw-r--r-- | mrblib/enum.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mrblib/enum.rb b/mrblib/enum.rb index fe40b4d27..15687e159 100644 --- a/mrblib/enum.rb +++ b/mrblib/enum.rb @@ -73,6 +73,8 @@ module Enumerable # # ISO 15.3.2.2.4 def detect(ifnone=nil, &block) + return to_enum :detect, ifnone unless block + self.each{|*val| if block.call(*val) return val.__svalue @@ -282,6 +284,8 @@ module Enumerable # # ISO 15.3.2.2.16 def partition(&block) + return to_enum :partition unless block + ary_T = [] ary_F = [] self.each{|*val| @@ -302,6 +306,8 @@ module Enumerable # # ISO 15.3.2.2.17 def reject(&block) + return to_enum :reject unless block + ary = [] self.each{|*val| ary.push(val.__svalue) unless block.call(*val) |
