From: ts Date: 2002-03-18T22:06:16+09:00 Subject: Re: eval/Module question (clearer) >>>>> "D" == David Corbin writes: D> #!/usr/local/bin/ruby 1.7 but you can write something similar in 1.6 D> module Gamma D> $x= < module Alpha D> class Beta D> def test D> puts("OK") D> end D> end D> end D> EOF D> eval $x eval $x, class Object; binding; end D> result=Object D> result.const_get("Gamma").const_get("Alpha").const_get("Beta").new() #Works D> result=Object D> result.const_get("Alpha").const_get("Beta").new() #Fails begin Object.const_get("Gamma").const_get("Alpha").const_get("Beta").new() rescue NameError p $! end Object.const_get("Alpha").const_get("Beta").new.test D> end D> ---snip--- Guy Decoux