module SyntaxTree::Index
This class can be used to build an index of the structure of Ruby files. We define an index as the list of constants and methods defined within a file.
This index strives to be as fast as possible to better support tools like IDEs. Because of that, it has different backends depending on what functionality is available.
Constants
- INDEX_BACKEND
The class defined here is used to perform the indexing, depending on what functionality is available from the runtime.
Public Class Methods
index(source, backend: INDEX_BACKEND.new)
click to toggle source
This method accepts source code and then indexes it.
# File lib/syntax_tree/index.rb, line 674 def self.index(source, backend: INDEX_BACKEND.new) backend.index(source) end
index_file(filepath, backend: INDEX_BACKEND.new)
click to toggle source
This method accepts a filepath and then indexes it.
# File lib/syntax_tree/index.rb, line 679 def self.index_file(filepath, backend: INDEX_BACKEND.new) backend.index_file(filepath) end