Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Prefergrep andgrep_v toselect/reject that does a regexp match (Ruby 3+) #884

Open
@dvandersluis

Description

@dvandersluis

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp