Return to Snippet

Revision: 10752
at January 12, 2009 23:34 by eugegim


Initial Code
require "yaml"

class Hello
  attr_reader :monkey
  def hoho
    @monkey = "bob"
  end
end

a = Hello.new
a.hoho

puts a.to_yaml.inspect

b = Hello.new

puts b.to_yaml.inspect

aa = "--- !ruby/object:Hello nmonkey: bobn"
bb = "--- !ruby/object:Hello {}nn"

aaa = YAML::load(aa)
bbb = YAML::load(bb)

puts aaa.inspect
puts bbb.inspect

puts aaa.monkey
puts bbb.monkey

Initial URL


Initial Description


Initial Title
Yaml Serialization Example

Initial Tags
textmate

Initial Language
Other