y[via comp.lang.ruby]

Easy, just yaml them to find out how the serialized form should look:
  class Item 
     attr_accessor :name 
     attr_accessor :type 
     attr_accessor :location 
     def initialize 
       @name = "" 
       @type = "" 
       @location = "" 
     end 
   end 
   require 'yaml' 
   y Item.new

If you run this you get:
--- !ruby/object:Item 
location: "" 
name: "" 
type: "" 

Then you can play with the string and check that YAML.load does the
right thing on this data

你可能感兴趣的:(java,Ruby)