-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
exclude reader methods that ends with a question mark #326
Conversation
As attr_reader can't deal with variables ending with '?' Another possible work around it is to use: class Foo attr_reader :empty alias_method :empty?, :empty end
Personally, I use |
private | ||
|
||
def predicate?(method_name) | ||
!(method_name[-1] == '?' || TrivialAccessors.allow_predicates) |
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.
Something is a predicate method even if allow_predicates
is false
. For clarity's sake I think the ||
should not be part of that method.
I've done a few changes to that cop to address another issue. Please, rebase your changes on top of the current |
I did the necessary changes myself. |
Great! I wouldn't have time to get back to this until the weekend... |
You're welcome :-) |
As attr_reader can't deal with variables ending with '?'
Another possible work around it is to use:
class Foo
attr_reader :empty
alias_method :empty?, :empty
end