From: why the lucky stiff Date: 2004-03-30T01:29:47+09:00 Subject: Re: YAML and initializers Hal Fulton wrote: > > Other questions... > > 1. Have you given any thought to preserving comments in yaml files? > E.g., I read in an entire file, modify some stuff, and write it out > again -- any practical way to keep the comments? Okay, yeah. It's one of those things I'd like to have, but there hasn't been a big demand for it. Truly: I'm not too excited about coding it in. But I could really use it as well. > 2. I wish for a little more control over formatting. Possible? > a. Specify order of fields instead of alphabetic > b. Align field names and data in a "prettyprinted" way Specifying field order is a cinch. class MyClass def to_yaml_properties ['@gamma', '@beta', '@alpha'] end end See the 'Type Families'[1] section in the docs for the low down on customizing loading and emitting further. As for 2b, give me another day and I'll 'splain about how to lay things out with perfect daintiness. Just takes a minute to detail. _why [1] http://yaml4r.sourceforge.net/doc/page/type_families.htm