Class: Prism::NodeFind::RubyVMBacktraceLocationFind
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Find
|
|
|
Instance Chain:
self,
Find
|
|
| Inherits: |
Prism::NodeFind::Find
|
| Defined in: | lib/prism/node_find.rb |
Overview
Finds the AST node for a Thread::Backtrace::Location using the node_id from the backtrace location.
Instance Method Summary
-
#find(location)
Findthe node for the given backtrace location using node_id.
Find - Inherited
| #parse_file | Parse the given file path, returning a |
Instance Method Details
#find(location)
Find the node for the given backtrace location using node_id.
# File 'lib/prism/node_find.rb', line 83
def find(location) file = location.absolute_path || location.path return unless (result = parse_file(file)) return unless RubyVM::AbstractSyntaxTree.respond_to?(:node_id_for_backtrace_location) node_id = RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(location) result.value.find { |node| node.node_id == node_id } end