Issue #7269 has been updated by headius (Charles Nutter).


I don't like the idea that using should affect methods already defined. At this point I view using similar to private/protected/etc, which also do not affect methods defined before you call them.
----------------------------------------
Bug #7269: Refinement doesn't work if using locate after method
https://bugs.ruby-lang.org/issues/7269#change-32297

Author: ko1 (Koichi Sasada)
Status: Open
Priority: Normal
Assignee: shugo (Shugo Maeda)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-01 trunk 37404) [i386-mswin32_100]


Refinement doesn't work if using locate after method.
(I eliminate discussion because my laptop doesn't have enough power...)


class C
  def foo
    p :C_foo
  end
end

module M1
  refine C do
    def foo
      p :M1_foo
      super
    end
  end
end

module M2
  refine C do
    def foo
      p :M2_foo
      super
    end
  end
end

class D
  using M1

  def x
    C.new.foo
  end

  using M2
end

p :x
D.new.x

#=>
:x
:M1_foo
:C_foo



-- 
http://bugs.ruby-lang.org/