Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Opening a class body doesn't reset the value of __method__ #1402
It appears we have never set a method name on the current frame for class and module bodies. When entering a class or module, we simply clone the previous call's frame and do not clear the name therein. That causes method, callee, caller, and others to show the outer method's name.
I believe this is special-cased logic, however. Kernel#caller does show a name, albeit one appropriate to a class:
The fact that method and callee return nil indicates they're specializing that logic for when the surrounding frame is a class.