Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delimiters' and related predicates for RegexpNode` #41

Merged
merged 4 commits into from Jun 22, 2020

Conversation

owst
Copy link
Contributor

@owst owst commented Jun 15, 2020

@@ -32,6 +32,11 @@ def content
children.select(&:str_type?).map(&:str_content).join
end

# @return [Bool] if char is one of the delimiters
def delimiter?(char)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can also add a delimiters method that returns the two of them and implement this one in terms of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea - I took a quick look for related predicates used by RuboCop, so added those too, let me know what you think

@bbatsov
Copy link
Contributor

bbatsov commented Jun 16, 2020

Great work!

CHANGELOG.md Outdated
@@ -8,6 +8,7 @@
* [#20](https://github.com/rubocop-hq/rubocop-ast/pull/20): Add option predicates for `RegexpNode`. ([@owst][])
* [#11](https://github.com/rubocop-hq/rubocop-ast/issues/11): Add `argument_type?` method to make it easy to recognize argument nodes. ([@tejasbubane][])
* [#31](https://github.com/rubocop-hq/rubocop-ast/pull/31): Use `param === node` to match params, which allows Regexp, Proc, Set, etc. ([@marcandre][])
* [#41](https://github.com/rubocop-hq/rubocop-ast/pull/41): Add `delimiters' and related predicates for `RegexpNode`. ([@owst][])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've made a small mistake with the backticks here.

@owst owst changed the title Add delimiter?' predicate for RegexpNode` Add delimiters' and related predicates for RegexpNode` Jun 16, 2020
@bbatsov bbatsov merged commit 41306ed into rubocop:master Jun 22, 2020
@bbatsov
Copy link
Contributor

bbatsov commented Jun 22, 2020

Thanks!

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.

None yet

2 participants