YAML serialization seems to be failing for me with any structure that
involves a hash with a set key. Is there documentation anywhere on what
sorts of objects are able to be serialized/deserialized via YAML? Or if
this is a bug that’s fixed in a newer ruby version (I’m using
1.9.1p378)? I would have expected this to work…
Example failing case
YAML.load(YAML.dump({[1].to_set=>1}))
Set itself seems to work fine
YAML.load(YAML.dump([1,2,3].to_set)
ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux]
irb
irb(main):001:0> require ‘yaml’
=> true
irb(main):002:0> require ‘set’
=> true
irb(main):003:0> YAML.load(YAML.dump({[1].to_set=>1}))
ArgumentError: syntax error on line 2, col -1: ` hash:
1: true
: 1
’
from /usr/lib/ruby/1.9.1/yaml.rb:133:in load' from /usr/lib/ruby/1.9.1/yaml.rb:133:in
load’
from (irb):11
from /usr/bin/irb:12:in `’