Class: Canon::Xml::Nodes::TextNode
- Inherits:
-
Canon::Xml::Node
- Object
- Canon::Xml::Node
- Canon::Xml::Nodes::TextNode
- Defined in:
- lib/canon/xml/nodes/text_node.rb
Overview
Text node in the XPath data model
Stores both the decoded text value and the original text (with entity references preserved) to enable accurate round-trip serialization.
Instance Attribute Summary collapse
-
#original ⇒ Object
Returns the value of attribute original.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Canon::Xml::Node
Instance Method Summary collapse
-
#initialize(value:, original: nil) ⇒ TextNode
constructor
A new instance of TextNode.
- #name ⇒ Object
- #node_type ⇒ Object
- #text_content ⇒ Object
Methods inherited from Canon::Xml::Node
#add_child, #in_node_set=, #in_node_set?, #parse_errors, #parse_errors=
Constructor Details
#initialize(value:, original: nil) ⇒ TextNode
Returns a new instance of TextNode.
22 23 24 25 26 |
# File 'lib/canon/xml/nodes/text_node.rb', line 22 def initialize(value:, original: nil) super() @value = value @original = original || value end |
Instance Attribute Details
#original ⇒ Object
Returns the value of attribute original.
12 13 14 |
# File 'lib/canon/xml/nodes/text_node.rb', line 12 def original @original end |
#value ⇒ Object
Returns the value of attribute value.
11 12 13 |
# File 'lib/canon/xml/nodes/text_node.rb', line 11 def value @value end |
Instance Method Details
#name ⇒ Object
28 29 30 |
# File 'lib/canon/xml/nodes/text_node.rb', line 28 def name "#text" end |
#node_type ⇒ Object
32 33 34 |
# File 'lib/canon/xml/nodes/text_node.rb', line 32 def node_type :text end |
#text_content ⇒ Object
36 37 38 |
# File 'lib/canon/xml/nodes/text_node.rb', line 36 def text_content @value end |