Class: Marko::Renderers::Artifact

Inherits:
Renderer
  • Object
show all
Defined in:
lib/marko/renderers/artifact.rb

Overview

Artifact renderer

Constant Summary

Constants inherited from Renderer

Renderer::NL, Renderer::NN

Instance Method Summary collapse

Constructor Details

#initializeArtifact

Returns a new instance of Artifact.



8
9
10
# File 'lib/marko/renderers/artifact.rb', line 8

def initialize
  @topic = Topic.new
end

Instance Method Details

#render(topic) ⇒ Object

Parameters:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/marko/renderers/artifact.rb', line 13

def render(topic)
  root = <<~STR
    ---
    \% #{topic.title}
    \% #{topic[:author]}
    \% #{Time.now.strftime('%Y-%b-%d')}          
    ...
  STR
  
  topic.to_a.drop(1)
    .map{ @topic.render(it) }
    .unshift(root)
    .join(NN)
end