Skip to content

Instantly share code, notes, and snippets.

@LTe
Created April 24, 2013 18:37
Show Gist options
  • Save LTe/5454430 to your computer and use it in GitHub Desktop.
Save LTe/5454430 to your computer and use it in GitHub Desktop.
require 'delegate'
class Foo
end
class Bar < SimpleDelegator
def my_method
"YAY!"
end
end
object = Marshal.load(Marshal.dump(Bar.new(Foo.new)))
object.my_method # => "YAY!"
puts object.class # => Bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment