From: Brian Buckley Date: 2005-11-17T05:30:20+09:00 Subject: Re: YAML and constant objects > class Foo > attr_reader :name > def initialize name > @name = name > end > > def is_complex_yaml? > false > end > def to_yaml( opts = {} ) > YAML::quick_emit( nil, opts ) { |out| > out << "!ruby/foo " > self.name.to_yaml( :Emitter => out ) > } > end > end > YAML.add_ruby_type(/^foo/) do |type, val| > subtype, subclass = YAML.read_type_class(type, Foo) > val.split(/::/).inject(Object) { |p, n| p.const_get(n)} > end Joel, I don't yet fully understand your code Where can I find explanations of is_complex_yaml?, add_ruby_type, read_type_class and quick_emit? (My original class doesn't actually have a "name" attribute but maybe once I understand this better I can adapt). Brian Buckley