Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Thread::Backtrace::Location#path
path
vm_backtrace.c
View on GitHub ↗
static VALUE
location_path_m(VALUE self)
{
const rb_iseq_t *iseq = location_iseq(location_ptr(self));
return iseq ? rb_iseq_path(iseq) : Qnil;
}
Returns the file name of this frame. This will generally be an absolute path, unless the frame is in the main script, in which case it will be the script location passed on the command line.
For example, using caller_locations.rb from Thread::Backtrace::Location
Example
loc = c(0..1).first loc.path #=> caller_locations.rb