Module: OllamaAgent::RubyIndex::Naming

Defined in:
lib/ollama_agent/ruby_index/naming.rb

Overview

Builds a stable ā€œA::B::Cā€ string from Prism constant path nodes.

Class Method Summary collapse

Class Method Details

.full_constant_path(node) ⇒ Object

rubocop:disable Metrics/MethodLength – Prism node shape dispatch



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ollama_agent/ruby_index/naming.rb', line 10

def full_constant_path(node)
  case node
  when nil
    nil
  when Prism::ConstantReadNode
    node.name.to_s
  when Prism::ConstantPathNode
    parent = full_constant_path(node.parent)
    name = node.name.to_s
    parent ? "#{parent}::#{name}" : name
  when Prism::ConstantPathShellNode
    full_constant_path(node.name)
  end
end