Issue #13657 has been updated by JustJosh (Joshua Stowers).


Great! You're right, that will accomplish this _exactly_.

Do you see any hope in adding this functionality to `#reject` regardless of the existence of `#grep_v`?
This other method is difficult to make sense of unless the developers are either familiar with it already or have used `grep` extensively enough to recognize its purpose.

Adding the functionality would also reduce the number of methods developer's have to know.
Also it wouldn't hurt to have.

Thanks for pointing out the existence of `#grep_v`

----------------------------------------
Feature #13657: Simplify usage of Enumerable#reject
https://bugs.ruby-lang.org/issues/13657#change-65425

* Author: JustJosh (Joshua Stowers)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
The reject method is more complicated than it has to be when removing only a specific value.
It would be convenient if we could just plug in the value we wish to delete as an optional argument, for example:

~~~ ruby
[1, 2, 3, 4].reject(3) # => [1, 2, 4]
~~~

as apposed to:

~~~ ruby
[1, 2, 3, 4].reject { |element| element == 3 } # => [1, 2, 4]
~~~

The next best method I can think of is `#delete`, but that returns the value which is deleted.




-- 
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>