Class: SXRB::TextNode

Inherits:
Node
  • Object
show all
Defined in:
lib/sxrb/text_node.rb

Overview

Class representing special case of DOM nodes which contain only text, and don’t represent any particular element.

Instance Attribute Summary

Attributes inherited from Node

#attributes, #children, #name, #namespaces, #parent, #prefix, #uri

Instance Method Summary collapse

Methods inherited from Node

#append, #content

Constructor Details

#initialize(text) ⇒ TextNode

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TextNode.



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

def initialize(text)
  @text = text || ""
end

Instance Method Details

#append_text(text) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'lib/sxrb/text_node.rb', line 11

def append_text(text)
  @text << text
end

#textString

Accessor for text data kept in TextNode object.

Returns:

  • (String)


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

def text
  @text
end