L
Lars Olsson
Hi list!
What's the best way to remedy the error/warning that the following
code produces?
class Parent
def self.foo()
module_eval("def foo(); @foo; end")
module_eval("def foo=(newfoo); @foo = newfoo; end")
end
end
class Child < Parent
foo
end
c = Child.new
p c.foo
(running with ruby -w)
(eval):1: warning: instance variable @foo not initialized
nil
Sincerely
/lasso
What's the best way to remedy the error/warning that the following
code produces?
class Parent
def self.foo()
module_eval("def foo(); @foo; end")
module_eval("def foo=(newfoo); @foo = newfoo; end")
end
end
class Child < Parent
foo
end
c = Child.new
p c.foo
(running with ruby -w)
(eval):1: warning: instance variable @foo not initialized
nil
Sincerely
/lasso