class ArchSpec::RubydexIndex
Translates Rubydex’s semantic index into the small graph ArchSpec’s rules consume. Rubydex owns Ruby semantics here: declarations, constant resolution, ancestry and methods all come from its resolved graph. The Prism pass in Analyzer adds only syntax facts Rubydex does not expose.
Attributes
Public Class Methods
# File lib/archspec/rubydex_index.rb, line 17 def initialize(paths, syntax:, method_names: []) @paths = paths.map { |path| File.expand_path(path) }.to_set @syntax = syntax @configured_method_names = method_names.to_set @call_resolutions = {} end
Public Instance Methods
Source
# File lib/archspec/rubydex_index.rb, line 24 def populate(graph) @index = ::Rubydex::Graph.new @index.encoding = 'utf8' @index.index_all(paths.to_a.sort) @index.resolve add_constants(graph) add_methods(graph) add_ancestry(graph) add_constant_references(graph) resolve_call_sites add_diagnostics(graph) graph rescue ::Rubydex::Error, IOError, SystemCallError => error raise Error, "Rubydex could not index the project: #{error.message.lines.first&.strip}" end