From: manga.osyo@... Date: 2019-10-13T00:00:57+00:00 Subject: [ruby-core:95311] [Ruby master Bug#16242] Refinements method call to failed Issue #16242 has been updated by osyo (manga osyo). Its greated!! Thanks jeremy :) I will read pull request. ---------------------------------------- Bug #16242: Refinements method call to failed https://bugs.ruby-lang.org/issues/16242#change-81995 * Author: osyo (manga osyo) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.7.0 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Refinements method call to failed with `prepend`. ## No problem ```ruby module M # Methods that you want to call only within this context refine M do def refine_method "refine_method" end end using M def hoge # OK: `refine_method` calls the method refine_method end end class X include M end pp X.new.hoge # => "refine_method" ``` ## Problem * If `prepend` another module, the search for `refine_method` fails ```ruby module OtherM end module M # Added prepend prepend OtherM refine M do def refine_method "refine_method" end end using M def hoge # Error: `hoge': undefined local variable or method `refine_method' for # (NameError) refine_method end end class X include M end # Error pp X.new.hoge ``` ## Environment Reproduced in the following environment. ```ruby RUBY_VERSION # => "2.7.0" RUBY_REVISION # => "02dfa0f16361c498e0f529054b00e3e09730892b" RUBY_PLATFORM # => "x86_64-darwin17" ``` You can also confirm that it is reproduced here. https://wandbox.org/permlink/I6tQesDRntT7JZqB -- https://bugs.ruby-lang.org/ Unsubscribe: