I have some modules where I would like to use instance variables in. I'm currently initializing them like this:
module MyModule
def self.method_a(param)
@var ||= 0
# other logic goes here
end
end
I also could call a init method to initialize them:
def init
@var = 0
end
but this would mean I have to remember to always call it.
Is there a better way of doing this?