Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Refinements in method bodies aren't activated #3548
(Moved from a comment in #1062)
I've hit some strange behaviour trying to use refinements with version 184.108.40.206:
module Refinement refine Object do def new_method 'new method!' end end end class Thing using Refinement p in_class_definition: Object.new.new_method def test p in_method: Object.new.new_method end end Thing.new.test
It seems like there's something amiss with the lexical scoping of the method; in MRI, methods defined with the lexical scope where a refinement is activated can make use of that refinement. Is this expected behaviour in JRuby as of 220.127.116.11?
If you refine Integer, then calls against Fixnum should see that refinement. Obviously this is super inefficient right now and caches nothing. Relates to #3548.