Skip to content

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

class method

RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location

(::Thread::Backtrace::Location backtrace_location) -> ::Integer
RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(backtrace_location) → integer

Returns the node id for the given backtrace location.

Example
begin
  raise
rescue =>  e
  loc = e.backtrace_locations.first
  RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(loc)
end # => 0
See also .of .parse also in 4.0 · 3.4 · 3.3 · 3.2