Class: Cadenza::TextNode

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenza/nodes/text_node.rb

Overview

The TextNode is a very simple container for static text defined in your template.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ TextNode

Creates a new Cadenza::TextNode with the given text

Parameters:

  • text (String)

    see #text



10
11
12
# File 'lib/cadenza/nodes/text_node.rb', line 10

def initialize(text)
   @text = text
end

Instance Attribute Details

#textString

Returns the content of the text in this node.

Returns:

  • (String)

    the content of the text in this node



6
7
8
# File 'lib/cadenza/nodes/text_node.rb', line 6

def text
  @text
end

Instance Method Details

#==(rhs) ⇒ Boolean

Returns true if the given Cadenza::TextNode is equivalent by value to this node.

Parameters:

Returns:

  • (Boolean)

    true if the given Cadenza::TextNode is equivalent by value to this node.



22
23
24
# File 'lib/cadenza/nodes/text_node.rb', line 22

def ==(rhs)
   @text == rhs.text
end

#implied_globalsArray

Returns a list of global variable names implied by this node (none).

Returns:

  • (Array)

    a list of global variable names implied by this node (none).



15
16
17
# File 'lib/cadenza/nodes/text_node.rb', line 15

def implied_globals
   []
end