instance method
Kernel#caller_locations
(?::Integer start_or_range, ?::Integer length) -> ::Array[::Thread::Backtrace::Location]?
(?::Range[::Integer] start_or_range) -> ::Array[::Thread::Backtrace::Location]?
caller_locations(start=1, length=nil) → array or nil
caller_locations(range) → array or nil
vm_backtrace.c
View on GitHub ↗
static VALUE
rb_f_caller_locations(int argc, VALUE *argv, VALUE _)
{
return ec_backtrace_to_ary(GET_EC(), argc, argv, 1, 1, 0);
}
Returns the current execution stack—an array containing backtrace location objects.
See Thread::Backtrace::Location for more information.
The optional start parameter determines the number of initial stack entries to omit from the top of the stack.
A second optional length parameter can be used to limit how many entries are returned from the stack.
Returns nil if start is greater than the size of current execution stack.
Optionally you can pass a range, which will return an array containing the entries within the specified range.