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
The cop complains about the initialization of the attribute bar: "Use attr_writer to define trivial writer methods."
The issue is that I want bar to have a public read-only accessor and no writer (this attribute is initialized once only in the constructor).
Following the advice from the cop, will oblige:
-Create a writer it should be kept private method.
-That simple writer will only be used in the constructor. Thus a writer method for one single calling method!...
This will add burden to the class.
In fact, the cop should be excluded for any attribute initialized in the constructor and that attribute is nowhere else updated. Easy to say, but I realize that's a challenging check to implement.
The text was updated successfully, but these errors were encountered:
This cop is a bit too strict.
Consider the following class:
The cop complains about the initialization of the attribute bar:
"Use attr_writer to define trivial writer methods."
The issue is that I want bar to have a public read-only accessor and no writer (this attribute is initialized once only in the constructor).
Following the advice from the cop, will oblige:
-Create a writer it should be kept private method.
-That simple writer will only be used in the constructor. Thus a writer method for one single calling method!...
This will add burden to the class.
In fact, the cop should be excluded for any attribute initialized in the constructor and that attribute is nowhere else updated. Easy to say, but I realize that's a challenging check to implement.
The text was updated successfully, but these errors were encountered: