Issue #10578 has been updated by Shugo Maeda.

Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN

I've committed the patch because I consider this issue a bug.

However, I'm not sure whether it should be backported.

----------------------------------------
Bug #10578: Allow undefining methods in refinements
https://bugs.ruby-lang.org/issues/10578#change-51459

* Author: Peter Zotov
* Status: Closed
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* ruby -v: ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Since refinements are locally scoped monkey patches, and it is possible and useful to undef a method globally, I think refinements should allow to undef methods as well as def them.

For example:

~~~ ruby
module NoPlus
  refine String do
    undef +
  end
end

using NoPlus
"a" + "b"
~~~

Expected behavior: undefined method `+' for "a":String
Actual behavior: undef ignored

---Files--------------------------------
undef_in_refine.diff (992 Bytes)


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