Skip to content

Instantly share code, notes, and snippets.

@yawn
Created June 27, 2011 16:12
Show Gist options
  • Save yawn/1049179 to your computer and use it in GitHub Desktop.
Save yawn/1049179 to your computer and use it in GitHub Desktop.
class Foo
end
puts Foo.new
f = Foo.new
f.instance_eval do |e|
meta = class << e
self
end
meta.send :define_method, :to_s do
'hello'
end
end
puts f
puts Foo.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment