Skip to content

Instantly share code, notes, and snippets.

@carllerche
Created May 1, 2009 23:18
Show Gist options
  • Save carllerche/105316 to your computer and use it in GitHub Desktop.
Save carllerche/105316 to your computer and use it in GitHub Desktop.
module Awesome
def baz
puts "baz"
end
end
class Foo
end
backup_foo = Foo.clone
class Foo
include Awesome
end
foo_obj = Foo.new
foo_obj.baz # => baz
Object.send :remove_const, :Foo
Foo = backup_foo
foo_obj.baz # => baz
Foo.new.baz # NoMethodError: undefined method ‘baz’ for #<Foo:0x1d650>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment