Skip to content

Instantly share code, notes, and snippets.

@chudler
Created September 14, 2011 14:28
Show Gist options
  • Save chudler/1216711 to your computer and use it in GitHub Desktop.
Save chudler/1216711 to your computer and use it in GitHub Desktop.
class Foo
def bar
puts "There can be only one?"
end
end
f = Foo.new
orig_method = f.method(:bar)
def f.bar
puts "No, I'm bar"
end
new_method = f.method(:bar)
orig_method.call
new_method.call
which_one = f.method(:bar)
which_one.call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment