I found myself in need of some data serialization methods this evening and checked out Yaml which is billed as an “easy” way of saving an object (say a query result) and then later re-constituting that information back into something useful. Turns out this is a surprisingly difficult thing to do presently in Ruby as there have been some changes in behavior to the YAML libraries that complicate things.
I ended up just using XML, which is generally considered to be “heavier”, but for now at least is much easier to get working. If you’re unfamiliar with these constructs I’ve put an example below, these are the same two records, one as YAML, one as XML.
| YAML |
|
|---|---|
| XML |
|
For more on the reasons behind the current difficulties with YAML (at least when supporting multiple platforms of Ruby), checkout this post on CFIS about YAML troubles.
For an example of how easy it is to parse XML with Ruby, checkout this article on YDN: HOWTO Parse XML using Ruby

WHAT TO DO NOW?