Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Thread::Backtrace::Location#base_label

() -> ::String?
base_label

Returns the base label of this frame, which is usually equal to the label, without decoration.

Consider the following example:

Example
def foo
  puts caller_locations(0).first.base_label

  1.times do
    puts caller_locations(0).first.base_label

    1.times do
      puts caller_locations(0).first.base_label
    end
  end
end

The result of calling foo is this:

Example
foo
foo
foo
See also #absolute_path #inspect #label also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0