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
readonly
Returns the value of attribute original.
-
#value ⇒ Object
readonly
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
Methods inherited from Canon::Xml::Node
#add_child, #in_node_set=, #in_node_set?
Constructor Details
#initialize(value:, original: nil) ⇒ TextNode
Returns a new instance of TextNode.
19 20 21 22 23 |
# File 'lib/canon/xml/nodes/text_node.rb', line 19 def initialize(value:, original: nil) super() @value = value @original = original || value end |
Instance Attribute Details
#original ⇒ Object (readonly)
Returns the value of attribute original.
13 14 15 |
# File 'lib/canon/xml/nodes/text_node.rb', line 13 def original @original end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
13 14 15 |
# File 'lib/canon/xml/nodes/text_node.rb', line 13 def value @value end |
Instance Method Details
#name ⇒ Object
25 26 27 |
# File 'lib/canon/xml/nodes/text_node.rb', line 25 def name "#text" end |
#node_type ⇒ Object
29 30 31 |
# File 'lib/canon/xml/nodes/text_node.rb', line 29 def node_type :text end |