Class: Marko::Tasks::Parse

Inherits:
Object
  • Object
show all
Defined in:
lib/marko/tasks/parse.rb

Overview

Parse source files

Instance Method Summary collapse

Instance Method Details

#call(payload) ⇒ Array<Model::Topic>

Parameters:

Returns:



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/marko/tasks/parse.rb', line 12

def call(payload)
  parser = Parser::Source.new

  topics = payload
    .map{ parser.parse(it) }
    .flatten

  errors = topics.reject{ it.is_a?(Model::Topic) }
  fail Marko::StageError.new('Load stage failed', errors) \
    if errors.any?
    
  topics
end