Class: Semlogr::Templates::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/semlogr/templates/template.rb

Constant Summary collapse

EMPTY =
Template.new('', [TextToken::EMPTY])

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, tokens) ⇒ Template

Returns a new instance of Template.



8
9
10
11
# File 'lib/semlogr/templates/template.rb', line 8

def initialize(text, tokens)
  @text = text
  @tokens = tokens
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/semlogr/templates/template.rb', line 6

def text
  @text
end

#tokensObject

Returns the value of attribute tokens.



6
7
8
# File 'lib/semlogr/templates/template.rb', line 6

def tokens
  @tokens
end

Instance Method Details

#render(output, properties) ⇒ Object



13
14
15
16
17
# File 'lib/semlogr/templates/template.rb', line 13

def render(output, properties)
  @tokens.each do |token|
    token.render(output, properties)
  end
end