From: Daniel Bush Date: 2008-08-24T06:24:51+09:00 Subject: Re: YAML::load help Hi Jayson Jayson Williams wrote: > I have a hash of Structs that I am trying to save and load to a file > using YAML. I am able to save the YAML output to file, but when I use > var=YAML::load(File.open('file')) Do you mean: YAML::load(File.read('file')) > to load the data back in, var does not look like the original hash. > What am I doing wrong? What do you get when you call to_yaml on your struct ('ss' is a struct instance): irb(main):013:0> ss.to_yaml => "--- !ruby/struct:Customer \nname: foo\naddress: addr\n" irb(main):014:0> YAML.load(ss.to_yaml) => # Hash of structs works similarly. Are you checking the file before you read it back in? Regards, Daniel -- Posted via http://www.ruby-forum.com/.