I know that some say that class variables (e.g. @@class_var
) should be avoid in Ruby and should use the an instance variable (e.g. @instance_var
) in the class scope instead:
def MyClass
@@foo = 'bar' # Should not do this.
@foo = 'bar' # Should do this.
end
Why is the use of class variables frowned upon in Ruby?