-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Conversation
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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][]) |
There was a problem hiding this comment.
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.
delimiter?' predicate for
RegexpNode`delimiters' and related predicates for
RegexpNode`
Thanks! |
As suggested by @bbatsov here:
rubocop/rubocop#8138 (comment)