B
baalbek
In Java there is a construct like this:
Class clazz = Class.forName("Person");
Person person = (Person)clazz.newInstance();
Is there something similar available for Ruby, that is, can I create a
class on the fly only having this class' name as a string?
In other words, something like this (for Ruby):
person = Class.new("Person")
This does not work, but is there something that would work like this?
Thanks in advance!
Baalbek
Class clazz = Class.forName("Person");
Person person = (Person)clazz.newInstance();
Is there something similar available for Ruby, that is, can I create a
class on the fly only having this class' name as a string?
In other words, something like this (for Ruby):
person = Class.new("Person")
This does not work, but is there something that would work like this?
Thanks in advance!
Baalbek