End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Thread::Backtrace::Location#lineno
lineno
vm_backtrace.c
View on GitHub ↗
static VALUE
location_lineno_m(VALUE self)
{
return INT2FIX(location_lineno(location_ptr(self)));
}
Returns the line number of this frame.
For example, using caller_locations.rb from Thread::Backtrace::Location
Example
loc = c(0..1).first loc.lineno #=> 2