Forum: Ruby-dev Method#owner returns wrong owner if using prepend.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2014-02-18 06:16
(Received via mailing list)
Issue #9526 has been updated by Boris Stitnicky.

Also for me, this is the expected behavior. `MyMod` is prepended before
`Blah`, and therefore ` :x )` is taken from `MyMod`. As
soon as you perform `module MyMod; remove_method( :x ) end`, method `x`
will be again taken from `Blah`.

Bug #9526: Method#owner returns wrong owner if using prepend.

* Author: Kaneko Yuichiro
* Status: Feedback
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: ruby-2.0.0-p353 [ x86_64 ] & ruby-2.1.0 [ x86_64 ]
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
rdoc indicates that Method#owner will return a class or module that
defines a method.

module MyMod
  def x(y)

class Blah
  def x(y)
    y + 1
  prepend MyMod
\# => MyMod
This topic is locked and can not be replied to.