Class: Marko::Loader
Overview
The strategy class for loading sources from repository
Constant Summary
Constants inherited from Service
Instance Method Summary collapse
-
#call ⇒ Array<TreeNode>, Array<String>
load markup sources, parse and return TreeNode buffer.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Marko::Service
Instance Method Details
#call ⇒ Array<TreeNode>, Array<String>
load markup sources, parse and return TreeNode buffer
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/marko/loader.rb', line 21 def call buffer = [] errors = [] parser = ParserPlug.plugged storage = StoragePlug.plugged storage.sources.each do |source| @block.(:source, source) if @block content = storage.content(source) buff, errs = parser.(content, source, &@block) buffer.concat(buff) errors.concat(errs) @block.(:errors, errs) if @block end [buffer.flatten, errors] end |