Issue #14197 has been updated by byroot (Jean Boussier).


> The point is that the phrase "hard to remember" in the OP is bit weak when we already have methods with the proposed behavior (`grep` and `grep_v`).

Indeed. However I think there is a case to be made for consistency. 

If this works:

~~~ ruby
%(foo bar).all?(String)
~~~


I do expect this to work as well.

~~~ ruby
%(foo bar).reject(String)
~~~


It is true that then `select` would end up being an alias of `grep` and `reject` an alias of `grep_v`, but I actually see it as a good thing. 

----------------------------------------
Feature #14197: `Enumerable#{select,reject}` accept a pattern argument
https://bugs.ruby-lang.org/issues/14197#change-72521

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
`#all?`, `#any?`, `#none?`, and `#one?` accept a pattern argument since 2.5.0.
But `#select`, and `#reject` don't.

The features are exist as `#grep`, and `#grep_v`, but there are hard to remember for me when I use `#select`, or `#reject`.

So I want to write

```ruby
collection.reject(/re/)
```

instead of

```ruby
collection.reject {|item| /re/ =~ item }
```

nor

```ruby
collection.grep_v(/re/)
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>