Class: Macros4Cuke::Templating::StaticText

Inherits:
Object
  • Object
show all
Defined in:
lib/macros4cuke/templating/engine.rb

Overview

Class used internally by the template engine.
Represents a static piece of text from a template.
A static text is a text that is reproduced verbatim when rendering a template.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aSourceText) ⇒ StaticText

Returns a new instance of StaticText.

Parameters:

  • aSourceText (String)

    A piece of text extracted from the template that must be rendered verbatim.



24
25
26
# File 'lib/macros4cuke/templating/engine.rb', line 24

def initialize(aSourceText)
  @source = aSourceText
end

Instance Attribute Details

#sourceObject (readonly)

The static text extracted from the original template.



20
21
22
# File 'lib/macros4cuke/templating/engine.rb', line 20

def source
  @source
end

Instance Method Details

#render(aContextObject, theLocals) ⇒ String

Render the static text. This method has the same signature as the Engine#render method.

Returns:

  • (String)

    Static text is returned verbatim ("as is")



33
34
35
# File 'lib/macros4cuke/templating/engine.rb', line 33

def render(aContextObject, theLocals)
  return source
end