From: merch-redmine@... Date: 2019-09-09T23:55:06+00:00 Subject: [ruby-core:94880] [Ruby master Bug#16106] UnboundMethod owner points to base class Issue #16106 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Closed The documentation for `owner` states: `Returns the class or module that defines the method.`. The example given in the documentation shows `method` being called on a Range instance, but having an owner of Enumerable. So I don't think documentation updates are necessary, and this can be closed. ---------------------------------------- Bug #16106: UnboundMethod owner points to base class https://bugs.ruby-lang.org/issues/16106#change-81496 * Author: sbellware (Scott Bellware) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin17] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- This may not be a bug. It may be my misinterpretation of the feature. When using UnboundMethod#owner on a class that was created with `Class.new(SomeBaseClass)`, the owner is reported as the `SomeBaseClass `rather than the new class. This was a surprising outcome, since I presumed that the owner method would point to the class rather than the class's base class. Example: ``` class SomeClass def some_method end end C = Class.new(SomeClass) m = C.instance_method(:some_method) pp m.owner # => SomeClass # I would have expected the owner to be C ``` Is this expected behavior? Thanks, Scott ---Files-------------------------------- unbound_method_owner_sketch.rb (176 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>