Project

General

Profile

Actions

Feature #6150

closed

add Enumerable#grep_v

Added by sunaku (Suraj Kurapati) about 12 years ago. Updated over 11 years ago.

Status:
Rejected
Target version:
[ruby-core:43313]

Description

Please add a grep_v() method to Enumerable that behaves like the opposite of grep().

For example, if Enumerable#grep() was implemented like this:

module Enumerable
def grep pattern
select {|x| pattern =~ x }
end
end

then Enumerable#grep_v() would be implemented like this (select becomes reject):

module Enumerable
def grep_v pattern
reject {|x| pattern =~ x }
end
end

The method name "grep_v" comes from the "-v" option passed to grep(1).

Thanks for your consideration.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0