From: why the lucky stiff Date: 2005-03-22T05:22:23+09:00 Subject: Re: YAML Parsing, ignoring objects? Travis Smith wrote: >I have a class which when YAMLized produces... > >--- !ruby/object:Player >name: dude >password: dude >session: !ruby/object:TCPSocket {} >thread: !ruby/object:Thread {} > >I'd like to figure out a way for it to just ignore the Thread and/or >TCPSocket type. It won't choke on the socket, but it will loading up >the Thread. Can I add a domain type that will just produce nil not >matter what happens? > > Hey, Travis. You can define to_yaml_properties for any object, which is simply an method which returns an array of properties you want in your YAML doc, in the order you like. class Player def to_yaml_properties; ['@name', '@password']; end end You can read more in the docs[1]. See the section "Type Families". _why [1] http://yaml4r.sf.net/doc/