From: Bill Roberts Date: 2006-05-01T20:52:12+09:00 Subject: Re: how to create Class object with name determined at runti John Johnson wrote: > You can use eval() to do that, like so: > irb(main):001:0> a='String' > => "String" > irb(main):002:0> b=eval("#{a}.new") > => "" > irb(main):003:0> b.class > => String > irb(main):004:0> > > In the second irb line, the contents of the variable _a_ are substituted > in the string before the .new. It amounts to b=eval("String.new"). > > Regards, > JJ > > John - thanks, also a neat solution. Having had experience mainly in static/compiled languages previously, I am just getting to grips with Ruby's nice features for adapting itself as it runs. -- Posted via http://www.ruby-forum.com/.