Class: RubyLens::Index::ConstantReferenceCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/rubylens/index/constant_reference_collector.rb

Overview

Turns Rubydex's resolved constant references into two different things: the complete inbound reference count for every workspace namespace, and a bounded sample of directed links the renderer animates as travel.

The two have deliberately different contracts. Counts are exact. Links stop at the limits below and are never ranked, so they are a visual sample and must not be read as a complete relationship or call graph.

Defined Under Namespace

Classes: Summary

Constant Summary collapse

1_024
ATTRIBUTION_LIMIT =
LINK_LIMIT * 2

Instance Method Summary collapse

Constructor Details

#initialize(locations:) ⇒ ConstantReferenceCollector

: (locations: LocationIndex) -> void



27
28
29
# File 'lib/rubylens/index/constant_reference_collector.rb', line 27

def initialize(locations:)
  @locations = locations
end

Instance Method Details

#call(graph:, namespaces:, definition_ranges:, ordinal_by_name:, dependency_ordinal_by_name:, namespace_count:) ⇒ Object

namespaces are the collector's workspace namespaces in ordinal order; ordinal_by_name and dependency_ordinal_by_name address link endpoints, with dependency ordinals offset past the namespace block.

: (graph: Rubydex::Graph, namespaces: Array, definition_ranges: Hash[String, Array[DeclarationCollector::definition_range]], ordinal_by_name: Hash[String, Integer], dependency_ordinal_by_name: Hash[String, Integer], namespace_count: Integer) -> Summary



36
37
38
39
40
41
# File 'lib/rubylens/index/constant_reference_collector.rb', line 36

def call(graph:, namespaces:, definition_ranges:, ordinal_by_name:, dependency_ordinal_by_name:, namespace_count:)
  Summary.new(
    inbound_counts: inbound_counts(namespaces),
    links: links(graph, definition_ranges, ordinal_by_name, dependency_ordinal_by_name, namespace_count),
  )
end