Skip to content
  • Jeremy Evans's avatar
    1e215a66
    Fix class of method in Method#inspect for singleton classes of classes · 1e215a66
    Jeremy Evans authored
    Previously, due to a change to fix bug 15608, Method#inspect output
    changed for class methods:
    
    Ruby 2.7
    "#<Method: String.prepend(*)>"
    
    Before change:
    "#<Method: #<Class:Object>(Module)#prepend(*)>"
    
    This is wrong because the Method object was created from String and
    not Object. This is because the fix for bug 15608 assumed it was
    being called on the singleton class of a instance, and would skip
    the first singleton class until it got to the class itself.  For
    class methods, this results in always using the superclass. Fix
    behavior to not skip until the superclass if the singleton class
    is the singleton class of a module or class.
    
    After change:
    "#<Method: #<Class:Object>(Module)#prepend(*)>"
    
    Fixes [Bug #17428]
    1e215a66
    Fix class of method in Method#inspect for singleton classes of classes
    Jeremy Evans authored
    Previously, due to a change to fix bug 15608, Method#inspect output
    changed for class methods:
    
    Ruby 2.7
    "#<Method: String.prepend(*)>"
    
    Before change:
    "#<Method: #<Class:Object>(Module)#prepend(*)>"
    
    This is wrong because the Method object was created from String and
    not Object. This is because the fix for bug 15608 assumed it was
    being called on the singleton class of a instance, and would skip
    the first singleton class until it got to the class itself.  For
    class methods, this results in always using the superclass. Fix
    behavior to not skip until the superclass if the singleton class
    is the singleton class of a module or class.
    
    After change:
    "#<Method: #<Class:Object>(Module)#prepend(*)>"
    
    Fixes [Bug #17428]
Loading