M
MrBanabas
Hi,
I would like to have a mixin which adds an instance variable to a
class. I ve tried it the following way:
I ve defined a little module:
module MyApp
module MyMixin
def self.included(base)
@should_be_an_instance_variable = nil
end
end
end
which is included by my little class:
class MyClass
include MyApp::MyMixin
end
However, it seems that @should_be_an_instance_variable is currently
defined per mixin, but I would like to have a unique one for each
object of MyClass.
Maybe anybody can help me?
Thanks a lot in advance.
I would like to have a mixin which adds an instance variable to a
class. I ve tried it the following way:
I ve defined a little module:
module MyApp
module MyMixin
def self.included(base)
@should_be_an_instance_variable = nil
end
end
end
which is included by my little class:
class MyClass
include MyApp::MyMixin
end
However, it seems that @should_be_an_instance_variable is currently
defined per mixin, but I would like to have a unique one for each
object of MyClass.
Maybe anybody can help me?
Thanks a lot in advance.