Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.4k
Open
Description
Reference:rubocop/rubocop#8327 andrubocop/rubocop#10082
The follow pairs have equivalent behaviour:
array.select{ |x|x.match?(REGEXP)}array.grep(REGEXP)array.reject{ |x|x.match?(REGEXP)}array.grep_v(REGEXP)
Previous to ruby 3,grep
/grep_v
had worse performance, but this was fixed byhttps://bugs.ruby-lang.org/issues/17030, so as of ruby 3,grep
could be prefered as it is simpler.
Metadata
Metadata
Assignees
Labels
No labels