J
John Lane
Hello,
I am trying to learn ruby and am experimenting with a Mixin.
I have the following test module: http://pastie.org/816001
On line 17, the class variable @@name gives an error:
uninitialized class variable @@name in TestMixin::ClassMethods
I understand it is because that's in a module within the TestMixin
module and that the @@name class variable is created in the including
class which is in a separate scope.
Can someone advise how this should be written so that a class method in
a mixin can access a class variable created by the mixin ?
Instance methods work fine.
Thanks in advance.
I am trying to learn ruby and am experimenting with a Mixin.
I have the following test module: http://pastie.org/816001
On line 17, the class variable @@name gives an error:
uninitialized class variable @@name in TestMixin::ClassMethods
I understand it is because that's in a module within the TestMixin
module and that the @@name class variable is created in the including
class which is in a separate scope.
Can someone advise how this should be written so that a class method in
a mixin can access a class variable created by the mixin ?
Instance methods work fine.
Thanks in advance.