Module: OllamaAgent::RubyIndex::Builder
- Defined in:
- lib/ollama_agent/ruby_index/builder.rb
Overview
Scans ‘.rb` files under root, parses with Prism, and merges index entries.
Defined Under Namespace
Classes: Run
Constant Summary collapse
- DEFAULT_MAX_FILES =
5000- DEFAULT_MAX_FILE_BYTES =
512_000
Class Method Summary collapse
- .build(root:, max_files: nil, max_file_bytes: nil) ⇒ Object
-
.each_rb_relative_path(root_path, max_files) ⇒ Object
rubocop:disable Metrics/MethodLength – Find.find callback.
- .env_int(name) ⇒ Object
Class Method Details
.build(root:, max_files: nil, max_file_bytes: nil) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/ollama_agent/ruby_index/builder.rb', line 19 def build(root:, max_files: nil, max_file_bytes: nil) Run.new( root: root, max_files: max_files, max_file_bytes: max_file_bytes ).call end |
.each_rb_relative_path(root_path, max_files) ⇒ Object
rubocop:disable Metrics/MethodLength – Find.find callback
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ollama_agent/ruby_index/builder.rb', line 37 def each_rb_relative_path(root_path, max_files) count = 0 Find.find(root_path.to_s) do |path| if File.directory?(path) && File.basename(path) == ".git" Find.prune next end next unless File.file?(path) next unless path.end_with?(".rb") rel = Pathname(path).relative_path_from(root_path).to_s yield rel count += 1 break if count >= max_files end end |
.env_int(name) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/ollama_agent/ruby_index/builder.rb', line 27 def env_int(name) v = ENV.fetch(name, nil) return nil if v.nil? || v.empty? Integer(v) rescue ArgumentError nil end |