Skip to content

Instantly share code, notes, and snippets.

@fronx
Created January 4, 2010 16:00
Show Gist options
  • Select an option

  • Save fronx/268611 to your computer and use it in GitHub Desktop.

Select an option

Save fronx/268611 to your computer and use it in GitHub Desktop.
class Class
def reincarnate
buried = Object.__send__(:remove_const, self.name)
Object.const_set(self.name, Class.new(buried))
end
end
class Abc
def foo
"foo"
end
end
Abc.reincarnate
class Abc
def foo
puts super
end
end
Abc.new.foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment