Issue #17428 has been updated by Eregon (Benoit Daloze).

Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: REQUIRED

Agreed that looks nice, but what should be shown from the example in #15608?
```
p obj.method(:foo)
#<Method: C#foo>
vs
#<Method: #<C:0x000055668ebef268>.foo(C#foo)>
```
based on whether the instance has a singleton class doesn't seem nice.

I wonder if always using the `#` notation wouldn't be simpler and more consistent (we'd always see the module in which the method is defined).
If it's a singleton class method, we might as well show the singleton class.

I think a new feature to discuss it would be best, the bug that @marcandre found has been fixed now.

----------------------------------------
Bug #17428: Method#inspect bad output for class methods
https://bugs.ruby-lang.org/issues/17428#change-89517

* Author: marcandre (Marc-Andre Lafortune)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* ruby -v: ruby 3.0.0dev (2020-12-22T17:37:59Z master 487355873a) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: REQUIRED
----------------------------------------
```
$ $ ruby -e 'p String.method(:prepend)'
# 2.7.0:
#<Method: String.prepend(*)>
# 3.0.0:
#<Method: #<Class:Object>(Module)#prepend(*)>
```

@jeremyevans found it shows the method as pertaining to one level too high (which is good for objects as we don't want to show the singleton class there, but not for classes).

Probably due to #15608



-- 
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>