I had a program which inherits from a superclass. It also has
common/convenience methods in a module.
require 'common' include 'Common' class Prog < Application f = Obj.new g = Foo.new #... etc ...
Some convenience methods rely on a variable being set in the superclass.
(I know that does not sound good but it shields this detail from
Then i refactored … moved a lot of functionality out from the program
to objects it was creating. I would guess that these objects should
not be able to call the module methods. Suprisingly, they were.
The problem came up that the variable was obviously not set when called
by these objects, (since the class of the module was now the object’s
class not the program’s class.)
So my basic question is: if a program includes a module, can all its
composed objects also call on the module.
What are the scope rules?
Any do’s and don’ts/insights/suggestions are welcome.