Class: Marko::Renderers::Topic

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

Overview

Topic renderer

Constant Summary

Constants inherited from Renderer

Renderer::NL, Renderer::NN

Instance Method Summary collapse

Constructor Details

#initializeTopic

Returns a new instance of Topic.



10
11
12
13
14
# File 'lib/marko/renderers/topic.rb', line 10

def initialize
  @title = Title.new
  @metadata = Metadata.new
  @content = Content.new
end

Instance Method Details

#render(topic) ⇒ Object



16
17
18
19
20
21
# File 'lib/marko/renderers/topic.rb', line 16

def render(topic)
  [ @title, @metadata, @content
  ].map{ it.render(topic) }
    .reject(&:empty?)
   .join(?\n)
end