Just yesterday I learned a little something in Ruby that I found interesting.
It’s the difference between __method__
and __callee__
.
Both are supposed to return the name of the current method, but there’s a subtle difference:
__method__
: returns the name of the method as defined__callee__
: returns the name of the method as called
I put together an example that illustrates the difference:
This illustrates very well the difference between “message” and “method”. One is the name we use to invoke a method. The other is the name of the method ultimately called.