Class: Aoororachain::Loaders::FileLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/aoororachain/loaders/file_loader.rb

Class Method Summary collapse

Class Method Details

.load(file, parser: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/aoororachain/loaders/file_loader.rb', line 6

def self.load(file, parser: nil)
  text = File.read(file)
   = {source: file}

  if !parser.nil?
    text,  = parser.parse(text)
    Aoororachain::Util.log_debug("Extracted metadata using parser #{parser.class}", {additional_metadata:})
    .merge!()
  end

  Aoororachain::Util.log_debug("File loaded", {file:})
  [Document.new(text, )]
end