I’m new to ruby and this list, so please forgive me if this is a silly
question but:
Is it possible to create an object of a specific type when all I have is the
name of the class in a string?
I’m wanting to serialize objects to XML, but I need to have the type
information stored in the XML and create objects of a type based on that
information. I have looked at the clxmlserial library but it needs to know
the type when re-creating objects. I have tried making a class
XmlSerializableObject with _dump and _load methods for use with Marshal, but
the type information is still stored in a non-xml format at the start of the
file. Do I need to write a module in c to do this?
I know we’ve been through this before, but I thought I’d repeat it
anyway. I have a slightly more robust version, called String#to_class,
which handles periods, “relative” class paths, and anonymous namespaces.