Class: HotwireClub::MCP::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/hotwire_club/mcp/loader.rb

Overview

Loader class for knowledge base documents

Direct Known Subclasses

FreeLoader, ProLoader

Class Method Summary collapse

Class Method Details

.load_docs(corpus_path = "corpus") ⇒ Array<Doc>

Load all documents from corpus directory

Parameters:

  • corpus_path (String) (defaults to: "corpus")

    Path to corpus directory

Returns:

  • (Array<Doc>)

    Array of Doc objects for files with ready: true



13
14
15
16
17
18
19
20
# File 'lib/hotwire_club/mcp/loader.rb', line 13

def self.load_docs(corpus_path = "corpus")
  corpus_dir = Pathname.new(corpus_path)
  return [] unless corpus_dir.directory?

  corpus_dir.glob("*.md")
            .map { |file| Doc.from_file(file.to_s) }
            .compact
end