Class instance variable for ruby modules

Sorry if the title is a bit misleading, but this post talks about the scenario such that I have several classes, all extending the same module, and I need to avoid using shared or class variables (@@) in the module because the classes extending the module may change the shared or class variable at the same time and cause problem. So basically we have: class Test   extend TestModule end class TestTwo   extend TestModule end module TestModule   @@val   def somemethod      #do something with @@val   end  end  And the goal is the replace the @@val class variable with a class … Continue reading Class instance variable for ruby modules