From: "naruse (Yui NARUSE)" Date: 2013-08-08T11:36:23+09:00 Subject: [ruby-core:56444] [ruby-trunk - Bug #8722][Assigned] Refinements remain active beyond the end of an evaled string Issue #8722 has been updated by naruse (Yui NARUSE). Status changed from Closed to Assigned m = Module.new { eval "module_function" def test1() end } r = m.respond_to?(:test1) ��� r ��� r42396 ������ true ������ false ������������������������ ---------------------------------------- Bug #8722: Refinements remain active beyond the end of an evaled string https://bugs.ruby-lang.org/issues/8722#change-40984 Author: charliesome (Charlie Somerville) Status: Assigned Priority: Normal Assignee: shugo (Shugo Maeda) Category: Target version: ruby -v: ruby 2.1.0dev (2013-08-02 trunk 42320) [x86_64-darwin12.4.0] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN =begin The [[RefinementsSpec]] states: "When main.using is invoked in a string given as the first argument of Kernel#eval, Kernel#instance_eval, or Module#module_eval, the end of the scope is the end of the string." However, in this example script, String#upcase remains refined even after the call to eval() has finished: module M refine String do def upcase reverse end end end puts "hello world".upcase puts eval(%{using M; "hello world".upcase}) puts "hello world".upcase I would expect the output of this script to be: HELLO WORLD dlrow olleh HELLO WORLD Instead it is: HELLO WORLD dlrow olleh dlrow olleh =end -- http://bugs.ruby-lang.org/ _______________________________________________ ruby-core mailing list ruby-core@ruby-lang.org http://lists.ruby-lang.org/cgi-bin/mailman/listinfo/ruby-core