The following code:

require 'yaml'

module A
   B = Struct.new(:c)
end

b = A::B.new(123)
str = YAML.dump(b)
puts str
bb = YAML.load(str)

Generates the following when run:

dave[tmp/ri2 11:31:00] ruby y.rb
--- !ruby/structA::B
c: 123
/usr/lib/ruby/1.8/yaml/rubytypes.rb:181:in `new': identifier :B needs 
to be constant (NameError)
         from /usr/lib/ruby/1.8/yaml/rubytypes.rb:181
         from /usr/lib/ruby/1.8/yaml/rubytypes.rb:168:in `call'
         from y.rb:1:in `transfer'
         from /usr/lib/ruby/1.8/yaml.rb:39:in `load'
         from /usr/lib/ruby/1.8/yaml.rb:39:in `load'
         from y.rb:10


The problem seems to be a missing colon between 'struct' and 'A' in the 
first line of the serialized form.


Cheers

Dave