End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Kernel#__callee__
__callee__ → symbol
eval.c
View on GitHub ↗
static VALUE
rb_f_callee_name(VALUE _)
{
ID fname = prev_frame_callee(); /* need *callee* ID */
if (fname) {
return ID2SYM(fname);
}
else {
return Qnil;
}
}
Returns the called name of the current method as a Symbol. If called outside of a method, it returns nil.