From: nobu@... Date: 2017-06-16T02:28:03+00:00 Subject: [ruby-core:81696] [Ruby trunk Bug#13446][Assigned] refinements with prepend for module has strange behavior Issue #13446 has been updated by nobu (Nobuyoshi Nakada). Description updated Status changed from Open to Assigned Assignee set to nobu (Nobuyoshi Nakada) ---------------------------------------- Bug #13446: refinements with prepend for module has strange behavior https://bugs.ruby-lang.org/issues/13446#change-65384 * Author: mtsmfm (Fumiaki Matsushima) * Status: Assigned * Priority: Normal * Assignee: nobu (Nobuyoshi Nakada) * Target version: * ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux] * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- ~~~ruby using Module.new { refine Enumerable do alias :orig_sum :sum end } module Enumerable def sum(*args) orig_sum(*args) end end class GenericEnumerable include Enumerable def each end end # GenericEnumerable.new.sum # if we uncomment this line, `GenericEnumerable#sum` will work Enumerable.prepend(Module.new) # if we comment out this line, `GenericEnumerable#sum` will work p GenericEnumerable.new.sum # undefined method `orig_sum' for # (NoMethodError) ~~~ Is this intentional? -- https://bugs.ruby-lang.org/ Unsubscribe: