Skip to content

Instantly share code, notes, and snippets.

@banister
Created June 3, 2012 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banister/2864811 to your computer and use it in GitHub Desktop.
Save banister/2864811 to your computer and use it in GitHub Desktop.
[2] (pry) main: 0> def multiply(x, y)
[2] (pry) main: 0* 2 * x * y
[2] (pry) main: 0* end
=> nil
[3] (pry) main: 0> alias old_multiply multipy
NameError: undefined method `multipy' for class `Object'
from (pry):5:in `<main>'
[4] (pry) main: 0> alias old_multiply multiply
=> nil
[5] (pry) main: 0> def multiply(x, y)
[5] (pry) main: 0* puts "wrapping old multiply"
[5] (pry) main: 0* old_multiply(x, y)
[5] (pry) main: 0* end
=> nil
[6] (pry) main: 0> multiply(2, 3)
wrapping old multiply
=> 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment