You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RuboCop added a cop in 2020 that covers this: rubocop/rubocop#8381. Our style guide matches the default for this cop, and otherwise it's mostly a matter of preference.
I don't agree with the preference expressed in the guide, but I think I understand the issue. Consider this Ruby code:
As far as I know, that's the only way to support usage like this:
I mean, using a class variable would cause it to be shared by
A
andB
, which we don't want.Does that sound right to you? Is there another way to implement that snippet above?
I think the same thing is true for
alias
, it only works for class methods insideclass << self
.So, I don't agree with the preference, but I think that explains the difference, does that make sense?
Originally posted by @rmosolgo in #7 (comment)
The text was updated successfully, but these errors were encountered: