> > It would be great if I could save and load this entire class with > > something as simple as: > > > > xml_save(addressbook, "file.xml") > > addressbook = xml_open("file.xml") > > If you want to serialize objects, YAML4R makes it quick and easy... > http://yaml4r.sourceforge.net/ And if you want XML, you can try http://clabs.org/clxmlserial.htm. Biggest thing it lacks now is it can't handle circular references. Sample: require 'cl/xmlserial' class MyClass include XmlSerialization attr_accessor :attr def initialize attr = 0 end end doc = REXML::Document.new(File.open("class.xml")) c = MyClass.from_xml(doc.root) c.attr = 60 f = File.new("class.xml", File::CREAT|File::TRUNC|File::RDWR) c.to_xml.write(f, -1) f.close yields either: <MyClass> <attr> <Fixnum>60</Fixnum> </attr> </MyClass> or: <MyClass> <attr>60</attr> </MyClass>