Module: OllamaChat::InputContent

Included in:
Chat
Defined in:
lib/ollama_chat/input_content.rb

Overview

A module that provides input content processing functionality for OllamaChat.

The InputContent module encapsulates methods for reading and returning content from selected files, selecting files from a list of matching files, and collecting project context using the context_spook library. It supports interactive file selection and context collection for enhancing chat interactions with local or remote content.

Instance Method Summary collapse

Instance Method Details

#file_set_each(patterns, all: false) {|file| ... } ⇒ Array<File>

The file_set_each method iterates over a set of files matched by the given patterns, optionally including all files, and yields each file to the supplied block. It returns the array of files that were processed.

Parameters:

  • patterns (Array<String>)

    the list of patterns to match files against

  • all (TrueClass, FalseClass) (defaults to: false)

    whether to include all files in the set

Yields:

  • (file)

    yields each file to the supplied block

Returns:

  • (Array<File>)

    the array of files that were processed



20
21
22
23
24
# File 'lib/ollama_chat/input_content.rb', line 20

def file_set_each(patterns, all: false, &block)
  files = all ? all_file_set(patterns) : choose_file_set(patterns)
  block and files.each(&block)
  files
end