From: shugo@... Date: 2015-02-05T06:49:07+00:00 Subject: [ruby-core:68018] [ruby-trunk - Bug #10578] [Assigned] Allow undefining methods in refinements Issue #10578 has been updated by Shugo Maeda. File undef_in_refine.diff added Status changed from Open to Assigned Assignee set to Yukihiro Matsumoto Peter Zotov wrote: > 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. The attached patch allow refinements to undef original methods. Matz, Can I commit it? And, is it considered a bug fix? ---------------------------------------- Bug #10578: Allow undefining methods in refinements https://bugs.ruby-lang.org/issues/10578#change-51405 * Author: Peter Zotov * Status: Assigned * 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 ---------------------------------------- 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/