From: Alexander Gehrke Date: 2012-07-04T15:38:04+09:00 Subject: Ruby yaml custom domain type does not keep class 0 down vote favorite I'm trying to dump duration objects (from the ruby-duration gem) to yaml with a custom type, so they are represented in the form hh:mm:ss. I've tried to modify the answer from this question, but when parsing the yaml with YAML.load, a Fixnum is returned instead of a Duration. Interestingly, the Fixnum is the total number of seconds in the duration, so the parsing seems to work, but convert to Fixnum after that. An example output in irb: irb> Duration.new(27500).to_yaml => "--- !example.com,2012-06-28/duration 7:38:20\n...\n" irb> YAML.load(Duration.new(27500).to_yaml) => 27500 # should be See attachment for code Attachments: http://www.ruby-forum.com/attachment/7561/yaml_duration.rb -- Posted via http://www.ruby-forum.com/.