Skip to content

Instantly share code, notes, and snippets.

@shugo
Created November 11, 2012 01:13
Show Gist options
  • Save shugo/4053256 to your computer and use it in GitHub Desktop.
Save shugo/4053256 to your computer and use it in GitHub Desktop.
module_eval with refinements confuses inline method cache
class C
def foo
"original"
end
end
module M
refine C do
def foo
"refined"
end
end
end
def m(*args)
C.new.foo
end
c = C.new
f = Proc.new { c.foo }
p f.() # "original"
p M.module_eval(&f) "refined"
p f.() # should be "original", but...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment