Class: Aoororachain::Loaders::DirectoryLoader

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

Instance Method Summary collapse

Constructor Details

#initialize(path:, glob:, loader:, parser: nil) ⇒ DirectoryLoader

Returns a new instance of DirectoryLoader.



6
7
8
9
10
11
# File 'lib/aoororachain/loaders/directory_loader.rb', line 6

def initialize(path:, glob:, loader:, parser: nil)
  @path = path
  @glob = glob
  @loader = loader
  @parser = parser
end

Instance Method Details

#loadObject



13
14
15
# File 'lib/aoororachain/loaders/directory_loader.rb', line 13

def load
  Dir.glob("#{@path}/#{@glob}").map { |file| @loader.load(file, parser: @parser) }
end