Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Kernel#__method__
__method__ → symbol
eval.c
View on GitHub ↗
static VALUE
rb_f_method_name(VALUE _)
{
ID fname = prev_frame_func(); /* need *method* ID */
if (fname) {
return ID2SYM(fname);
}
else {
return Qnil;
}
}
Returns the name at the definition of the current method as a Symbol. If called outside of a method, it returns nil.