L
Leon Bogaert
Hi all,
I'm trying to include a module and in that module I want to set an
instance variable. I have the following:
class Queue
include LBo::InstanceMethods
end
module LBo
module InstanceMethods
attr_accessor osition
self.position = 1
end
end
q = Queue.new
q.position
But I'm getting this error:
undefined method `position=' for LBo::InstanceMethods:Module
(NoMethodError)
I'm feeling like a moron because I can't understand why this is not
working.
I tried setting the @position variable directly, but when I do
q.position it gives back nil.
Could somebody lend me a hand with this one?
Thanks in advance!
I'm trying to include a module and in that module I want to set an
instance variable. I have the following:
class Queue
include LBo::InstanceMethods
end
module LBo
module InstanceMethods
attr_accessor osition
self.position = 1
end
end
q = Queue.new
q.position
But I'm getting this error:
undefined method `position=' for LBo::InstanceMethods:Module
(NoMethodError)
I'm feeling like a moron because I can't understand why this is not
working.
I tried setting the @position variable directly, but when I do
q.position it gives back nil.
Could somebody lend me a hand with this one?
Thanks in advance!