Last active
October 11, 2015 17:25
-
-
Save VelizarHristov/ab6e11db75f4c41aea95 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
# This is outside my control | |
class Foo | |
def self.bar | |
'Original' | |
end | |
end | |
Foo.bar # 'Original' | |
Foo.singleton_class.send(:alias_method, :old_bar, :bar) | |
def Foo.bar | |
'Mock' | |
end | |
Foo.bar # 'Mock' | |
Foo.singleton_class.send(:alias_method, :bar, :old_bar) | |
Foo.bar # 'Original' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment