How do I initialise

Hi, I'm playing around with module instance variables. I can set one up and initialise it when the module is included in a class. What I can't work out is how I initialise one when a class inherits another class that includes the module.


This creates two classes, the first inherits a module that contains an instance variable. The second inherits the first. The instance variable in the first class is initialised as expected, the second (inherited one) is not. The output I get is below:

the data for class One is Tue Apr 06 15:10:43 +0000 2010 the data for class Two is

How should I modify the module so that the initialisation takes place when the module is included via inheritance ?


You've got class instance variables which (unlike class variables) aren't shared around the inheritance hierachy at all. This is a slightly murky area which I wrote a bit about here:

Searching for class instance variables should also turn up some interesting reading material.


This is a slightly murky area

A murky area indeed. Been away from it for a few days but just sorted myself out with your help. Scope when playing with module that extend classes is little short of a nightmare.