Project

General

Profile

Actions

Bug #10578

closed

Allow undefining methods in refinements

Added by whitequark (whitequark *) over 9 years ago. Updated about 9 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
[ruby-core:66741]

Description

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:

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) undef_in_refine.diff shugo (Shugo Maeda), 02/05/2015 06:42 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0