From: mtsmfm@... Date: 2017-04-18T01:17:31+00:00 Subject: [ruby-core:80748] [Ruby trunk Bug#13446] refinements with prepend for module has strange behavior Issue #13446 has been reported by mtsmfm (Fumiaki Matsushima). ---------------------------------------- Bug #13446: refinements with prepend for module has strange behavior https://bugs.ruby-lang.org/issues/13446 * Author: mtsmfm (Fumiaki Matsushima) * Status: Open * Priority: Normal * Assignee: * 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 ---------------------------------------- ~~~ 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: