Created
October 18, 2011 18:19
-
-
Save mhorbul/1296208 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def foo | |
raise "error from old" | |
end | |
end | |
class A | |
def new_foo | |
raise "error from new method" | |
end | |
alias_method :old_foo, :foo | |
alias_method :foo, :new_foo | |
end | |
begin | |
A.new.foo | |
rescue => e | |
puts e.backtrace.join("\n") # => stack trace from the new method | |
end | |
class A | |
alias_method :foo, :old_foo | |
end | |
begin | |
A.new.foo | |
rescue => e | |
puts e.backtrace.join("\n") # => stack trace from the old method | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment