クラスを示す文字列からインスタンスを得る方法
クラスを示す文字列からインスタンスを得る方法
検索したら普通に出てきた。
http://bugs.ruby-lang.org/issues/767
def my_const_get(name) name.split(/::/).inject(Object){|o,c| o.const_get(c) } end module Hoge class Foo end end my_const_get('Hoge::Foo').new #=> #<Hoge::Foo:0x951bec8>
なるほど。なるほど。