Skip to content

Instantly share code, notes, and snippets.

@abscondment
Created January 14, 2016 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abscondment/ec3525f6984dacf149a3 to your computer and use it in GitHub Desktop.
Save abscondment/ec3525f6984dacf149a3 to your computer and use it in GitHub Desktop.
require 'yaml'
class Base < Struct.new(:base_id)
def doit
puts 'i have %s' % self.base_id
end
end
class Thing < Base
attr_accessor :foo
end
t = Thing.new(123)
dumped = YAML::dump(t)
loaded = YAML::load(dumped)
puts "DUMPED: #{dumped.inspect}"
puts "LOADED: foo=#{loaded.foo ? 'true' : 'false'}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment