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

Have def_modifier? return the def node or nil instead of boolean #171

Merged
merged 1 commit into from May 26, 2021

Conversation

marcandre
Copy link
Contributor

No description provided.

@marcandre marcandre self-assigned this Mar 8, 2021
@marcandre marcandre changed the title Simplify def_modifier. Improve doc. Have def_modifier? return the def node or nil instead of boolean Mar 9, 2021
@marcandre marcandre force-pushed the def_modifier branch 3 times, most recently from e733be0 to cb28d03 Compare March 9, 2021 04:22
@marcandre
Copy link
Contributor Author

@bbatsov Should I create a different method without the ??

@marcandre
Copy link
Contributor Author

Or maybe @dvandersluis ?

@dvandersluis
Copy link
Member

I don't have a strong opinion here but it probably makes more sense to not be a predicate method if its return method is purposefully an actual object, otherwise it's kind of a side effect.

@bbatsov
Copy link
Contributor

bbatsov commented May 26, 2021

I agree. I'd introduce a new method named def_modifier with the proposed behaviour. I've never been found of predicate methods that don't return booleans.

@marcandre
Copy link
Contributor Author

Ok, PR changed accordingly 👍

@marcandre marcandre merged commit 7b7b1f2 into rubocop:master May 26, 2021
@marcandre marcandre deleted the def_modifier branch May 26, 2021 14:15
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

3 participants