label

label()
Instance Public methods

Returns the label of this frame.

Usually consists of method, class, module, etc names with decoration.

Consider the following example:

1
2
3
4
5
6
7
8
9
10
11
12
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:

1
2
3
label: foo
label: block in foo
label: block (2 levels) in foo
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.