Class: Marko::Assembler

Inherits:
Service show all
Defined in:
lib/marko/assembler.rb

Overview

The strategy for assembling sources into artifact tree

Defined Under Namespace

Classes: Failure

Constant Summary

Constants inherited from Service

Service::Failure

Instance Method Summary collapse

Methods inherited from Service

call, inherited, #initialize

Constructor Details

This class inherits a constructor from Marko::Service

Instance Method Details

#callTreeNode

Returns:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/marko/assembler.rb', line 27

def call
  @block.(:stage, 'loading sources') if @block
  buffer, errors = Loader.(&@block)
  fail Failure.new('markup parsing errors', *errors) if errors.any?
  @block.(:stage, 'tree assemblage') if @block
  # @todo fold first level when root note contain only one item?
  tree = assemble(buffer)
  @block.(:stage, 'tree enrichment') if @block
  injectid(tree)
  @block.(:stage, 'tree validation') if @block
  errors = validate(tree)
  fail Failure.new('tree validation errors', *errors) if errors.any?
  tree
end