Hello
I have this code:
country = Struct.new("france".intern, :person)
person_class = Struct.new("person".intern)
meth = <<-METHOD
def method
@person = @person_class.new
end
METHOD
country.class_eval(meth)
c = country.new()
c.method()
this is my error message:
../temp.rb
(eval):2: warning: instance variable @person_class not initialized
(eval):2:in `method': undefined method `new' for nil (NoMethodError)
from ./temp.rb:17
the one that bothers me is the first one with "@person_class not
initialized"
is it possible to do this ?? I am not sure if this could work at all.
I also tried
"@person_class.name" + ".new"
but @person_class.name does return an empty string.
any ideas
Thanks in advance
Markus