Class: Cadenza::TextNode

Inherits:
Object
  • Object
show all
Includes:
TreeNode
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

Methods included from TreeNode

#to_tree

Constructor Details

#initialize(text) ⇒ TextNode

Creates a new Cadenza::TextNode with the given text

Parameters:

  • text (String)

    see #text


12
13
14
# File 'lib/cadenza/nodes/text_node.rb', line 12

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


8
9
10
# File 'lib/cadenza/nodes/text_node.rb', line 8

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.


24
25
26
# File 'lib/cadenza/nodes/text_node.rb', line 24

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).


17
18
19
# File 'lib/cadenza/nodes/text_node.rb', line 17

def implied_globals
   []
end