Skip to content

adds spec for Bug [#17030]#889

Merged
eregon merged 1 commit intoruby:masterfrom
moofkit:grep_last_match_no_modify
Oct 27, 2021
Merged

adds spec for Bug [#17030]#889
eregon merged 1 commit intoruby:masterfrom
moofkit:grep_last_match_no_modify

Conversation

@moofkit
Copy link
Copy Markdown
Contributor

@moofkit moofkit commented Oct 27, 2021

Solving #823

Enumerable#grep and Enumerable#grep_v when passed a Regexp and no block no longer modify
Regexp.last_match

There are specs already for $& - an global alias to Regexp.last_match. Maybe it make sense to leave one of them but use Regexp.last_match explicitly because it seems more clear IMO.

Enumerable#grep and Enumerable#grep_v when passed a Regexp and no block no longer modify
Regexp.last_match
@moofkit moofkit changed the title adds spec for Bug [#17030](https://bugs.ruby-lang.org/issues/17030) adds spec for Bug [#17030] Oct 27, 2021
@eregon
Copy link
Copy Markdown
Member

eregon commented Oct 27, 2021

Regexp.last_match and $& are the same thing, and given $& existed before I'd see Regexp.last_match as the alias, but I guess it's subjective.

I'm not really against adding these extra specs, so I'll merge this, though I wouldn't do that in too many places because it just checks again that they are the same thing.

@eregon eregon merged commit 7376aa0 into ruby:master Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants