Class: HTML5::TreeBuilders::REXML::TextNode

Inherits:
Node show all
Defined in:
lib/html5/treebuilders/rexml.rb

Instance Attribute Summary

Attributes inherited from Node

#rxobj

Attributes inherited from Base::Node

#_flags, #childNodes, #parent

Instance Method Summary collapse

Methods inherited from Node

#appendChild, #hasContent, #insertBefore, #insertText, #removeChild

Methods inherited from Base::Node

#appendChild, #cloneNode, #hasContent, #insertBefore, #insertText, #removeChild, #reparentChildren

Constructor Details

#initialize(data) ⇒ TextNode

Returns a new instance of TextNode.



159
160
161
162
# File 'lib/html5/treebuilders/rexml.rb', line 159

def initialize data
  raw = data.gsub('&', '&amp;').gsub('<', '&lt;').gsub('>', '&gt;')
  @rxobj = ::REXML::Text.new(raw, true, nil, true)
end

Instance Method Details

#printTree(indent = 0) ⇒ Object



164
165
166
# File 'lib/html5/treebuilders/rexml.rb', line 164

def printTree indent=0
  "\n|#{' ' * indent}\"#{rxobj.value}\""
end