Class: Oga::XML::CharacterNode
- Defined in:
- lib/oga/xml/character_node.rb
Overview
Base class for nodes that represent a text-like value such as Text and Comment nodes.
Direct Known Subclasses
Instance Attribute Summary collapse
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CharacterNode
constructor
A new instance of CharacterNode.
- #inspect ⇒ String
- #to_xml ⇒ String
Methods inherited from Node
#after, #before, #children, #children=, #html?, #next, #next_element, #parent, #previous, #previous_element, #remove, #replace, #root_node, #xml?
Methods included from Traversal
Constructor Details
#initialize(options = {}) ⇒ CharacterNode
Returns a new instance of CharacterNode.
16 17 18 19 20 |
# File 'lib/oga/xml/character_node.rb', line 16 def initialize( = {}) super @text = [:text] end |
Instance Attribute Details
#text ⇒ String
9 10 11 |
# File 'lib/oga/xml/character_node.rb', line 9 def text @text end |
Instance Method Details
#inspect ⇒ String
32 33 34 |
# File 'lib/oga/xml/character_node.rb', line 32 def inspect "#{self.class.to_s.split('::').last}(#{text.inspect})" end |
#to_xml ⇒ String
25 26 27 |
# File 'lib/oga/xml/character_node.rb', line 25 def to_xml text.to_s end |