Skip to content

Instantly share code, notes, and snippets.

@mbj
Created June 6, 2015 21:50
Show Gist options
  • Save mbj/20a0b7e739f32c2056fb to your computer and use it in GitHub Desktop.
Save mbj/20a0b7e739f32c2056fb to your computer and use it in GitHub Desktop.
Break ruby method dispatch
class Foo
def bar
p :original
end
end
module SomeModule
def bar
p :some_module
end
end
object = Foo.new
p object.bar # :original as expected
Foo.prepend(SomeModule)
p object.bar # :some_module as expected
module Hooker
undef :meth
end
p object.meth # expect :original, but raises UndefinedMethod error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment