Class: OllamaAgent::RubyIndex::Builder::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/ollama_agent/ruby_index/builder.rb

Overview

Orchestrates file discovery and Prism parsing.

Instance Method Summary collapse

Constructor Details

#initialize(root:, max_files:, max_file_bytes:) ⇒ Run

Returns a new instance of Run.



58
59
60
61
62
63
64
65
66
# File 'lib/ollama_agent/ruby_index/builder.rb', line 58

def initialize(root:, max_files:, max_file_bytes:)
  @root_path = Pathname(root).expand_path
  @max_files = normalized_max_files(max_files)
  @max_file_bytes = normalized_max_bytes(max_file_bytes)
  @constants = []
  @methods = []
  @errors = []
  @files_indexed = 0
end

Instance Method Details

#callObject



68
69
70
71
72
73
74
75
76
77
# File 'lib/ollama_agent/ruby_index/builder.rb', line 68

def call
  Builder.each_rb_relative_path(@root_path, @max_files) { |rel| ingest(rel) }
  Index.new(
    root: @root_path.to_s,
    constants: @constants.sort_by { |r| [r[:path], r[:start_line], r[:name]] },
    methods: @methods.sort_by { |r| [r[:path], r[:start_line], r[:name]] },
    errors: @errors,
    files_indexed: @files_indexed
  )
end