Skip to content

Instantly share code, notes, and snippets.

@francescoagati
Created April 26, 2010 12:32
Show Gist options
  • Save francescoagati/379268 to your computer and use it in GitHub Desktop.
Save francescoagati/379268 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'yaml'
class Player
attr_accessor :name,:surname
def initialize(opt={})
@name=opt[:name]
@surname=opt[:surname]
end
end
x=Player.new :name =>'mario', :surname => 'rossi'
obj = YAML::dump(x)
puts obj
puts YAML::load(obj).instance_variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment