Class: Phronomy::Loader::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/phronomy/loader/base.rb

Overview

Abstract base class for document loaders.

A loader converts an external source (file path, URL, etc.) into an Array of document hashes understood by the rest of the pipeline:

[{ text: String, metadata: Hash }, ...]

Subclasses must implement #load.

Direct Known Subclasses

CsvLoader, MarkdownLoader, PlainTextLoader

Instance Method Summary collapse

Instance Method Details

#load(source) ⇒ Array<Hash>

Load documents from +source+ and return an array of document hashes.

Parameters:

  • source (String)

    file path, URL, or other source identifier

Returns:

  • (Array<Hash>)

    array of { text: String, metadata: Hash }

Raises:

  • (NotImplementedError)

    when not overridden by a subclass



19
20
21
# File 'lib/phronomy/loader/base.rb', line 19

def load(source)
  raise NotImplementedError, "#{self.class}#load is not implemented"
end