For stylistic reasons I would like to avoid using class variables and would like to replace them with class instance variables. So if I have:
module SimpleForm
mattr_accessor :input_error_class
@@input_error_class = 'error-field'
...
end
and I change it to:
module SimpleForm
@input_error_class = 'error-field'
class << self
attr_accessor :input_error_class
end
...
end
will this break Simple Form?
If there is a class that is a subclass or a superclass of SimpleForm
that shared @@input_error_class
, then by changing a class variable to a class instance variable, the variable will not be shared by the sub/superclass anymore, and that may break the code. Also, if there is an instance method that uses the class variable, that may break the code. Otherwise, it does not break.