08 Apr '14, 11am
TIL about __callee__ in Ruby.
__callee__ and __method__ both return symbol when originally defined, not current There has been some indication that __callee__ is intended to return the symbol with which the method was actually invoked, whereas __method__ returns name with which the method was originally defined, but __callee__ actually behaves identically to __method__ in Ruby 1.9.1 1.9.2, and 1.9.3. This distinction is meaningful, because methods can be aliased after they are created. In Ruby 1.8.7, it was possible (though) not convenient to get the name of the method as actually invoked, by calling another method that extracts the name from caller .first. Even that hack no longer works in Ruby 1.9 though, since it will return the originally defined method name as well.