Actions
Feature #14197
open`Enumerable#{select,reject}` accept a pattern argument
Feature #14197:
`Enumerable#{select,reject}` accept a pattern argument
Status:
Open
Assignee:
-
Target version:
-
Description
#all?
, #any?
, #none?
, and #one?
accept pattern arguments since 2.5.0.
#grep
, and #grep_v
have such feature, but it is hard for me to remember them since I would be thinking of using #select
, or #reject
, and #select
and #reject
don't have such feature.
I want to write
collection.reject(/re/)
instead of
collection.reject {|item| /re/ =~ item }
or
collection.grep_v(/re/)
Actions