Last active
August 29, 2015 13:56
-
-
Save tagomoris/9182836 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 Foo | |
def self.foo | |
"foo" | |
end | |
def foo | |
"ifoo" | |
end | |
end | |
module Interceptor | |
refine Class do | |
def Foo.foo | |
"bar" | |
end | |
end | |
refine Foo do | |
def foo | |
"ibar" | |
end | |
end | |
end | |
using Interceptor | |
p Foo.foo #=> "bar" | |
p Foo.new.foo #=> "ibar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment