End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Thread::Backtrace::Location#label
label
vm_backtrace.c
View on GitHub ↗
static VALUE
location_label_m(VALUE self)
{
return location_label(location_ptr(self));
}
Returns the label of this frame.
Usually consists of method, class, module, etc names with decoration.
Consider the following example:
Example
def foo puts caller_locations(0).first.label 1.times do puts caller_locations(0).first.label 1.times do puts caller_locations(0).first.label end end end
The result of calling foo is this:
label: foo label: block in foo label: block (2 levels) in foo