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

protected visibility is discouraged #1687

Merged
merged 1 commit into from
Jun 25, 2020

Conversation

pablobm
Copy link
Collaborator

@pablobm pablobm commented Jun 25, 2020

Coming from other languages, it's tempting to use protected in Ruby. However this keyword has different nuanced in Ruby and is generally discouraged.

In Ruby, typical legitimate uses of protected include support methods for comparators and operators. None of the methods marked as protected here fall into this category, so I think they should be marked private instead.

Coming from other languages, it's tempting to use `protected` in Ruby.
However this keyword has different nuanced in Ruby and is generally
discouraged. It should only be used for methods required for comparators
and operators. None of the methods marked as `protected` here fall into
this category, so I think they should be marked `private` instead.
@nickcharlton nickcharlton added the maintenance to keep up with changes around us label Jun 25, 2020
@pablobm pablobm merged commit 844c270 into thoughtbot:master Jun 25, 2020
@pablobm pablobm deleted the private-over-protected branch June 28, 2020 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance to keep up with changes around us
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants