How can this line in Java be translated to Ruby:
String className = "java.util.Vector";
...
Object o = Class.forName(className).newInstance();
Thanks!
Object::const_get('String').new()
Object
. MyCoolModule::Submodule.const_get('MyString').new
If you're using ActiveSupport (i.e. Rails), there is a method added to String
that does this:
"String".constantize.new