Skip to content

Instantly share code, notes, and snippets.

@tagomoris
Last active August 29, 2015 13:56
Show Gist options
  • Save tagomoris/9182836 to your computer and use it in GitHub Desktop.
Save tagomoris/9182836 to your computer and use it in GitHub Desktop.
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