Issue #10826 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONE to 2.0.0: DONE, 2.1: DONE, 2.2: DONE

Backported into ruby_2_1 branch at r49992.

----------------------------------------
Bug #10826: Refinements make instance_methods(false) return methods of superclasses
https://bugs.ruby-lang.org/issues/10826#change-51866

* Author: Shugo Maeda
* Status: Closed
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-02-04 trunk 49489) [x86_64-linux]
* Backport: 2.0.0: DONE, 2.1: DONE, 2.2: DONE
----------------------------------------
If a method is refined for a subclass X of the owner of the method,
X.instance_methods(false) returns that method even if it's not defined
in X.


```ruby
class X
  def foo
  end
end

class Y < X
end

module Bar
  refine Y do
    def foo
    end
  end
end

p Y.instance_methods(false).include?(:foo) # false expected, but true is returned
```



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