Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
ErrorHighlight.prism_find
prism_find(location)
lib/error_highlight/base.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/error_highlight/base.rb, line 95
def self.prism_find(location)
return nil if prism::VERSION < "1.0.0"
absolute_path = location.absolute_path
return unless absolute_path
node_id = RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(location)
prism.parse_file(absolute_path).value.breadth_first_search { |node| node.node_id == node_id }
end
Accepts a Thread::Backtrace::Location object and returns a Prism::Node corresponding to the backtrace location in the source code.