Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Thread::Backtrace::Location#path

path

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
See also #lineno #to_s #label also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0