Class: SyntaxTree::XML::CharData
- Defined in:
- lib/syntax_tree/xml/nodes.rb
Overview
A CharData contains either plain text or whitespace within an element. It wraps a single token value.
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(value:, location:) ⇒ CharData
constructor
A new instance of CharData.
Methods inherited from Node
Constructor Details
#initialize(value:, location:) ⇒ CharData
Returns a new instance of CharData.
367 368 369 370 |
# File 'lib/syntax_tree/xml/nodes.rb', line 367 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
365 366 367 |
# File 'lib/syntax_tree/xml/nodes.rb', line 365 def location @location end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
365 366 367 |
# File 'lib/syntax_tree/xml/nodes.rb', line 365 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
372 373 374 |
# File 'lib/syntax_tree/xml/nodes.rb', line 372 def accept(visitor) visitor.visit_char_data(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
376 377 378 |
# File 'lib/syntax_tree/xml/nodes.rb', line 376 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
382 383 384 |
# File 'lib/syntax_tree/xml/nodes.rb', line 382 def deconstruct_keys(keys) { value: value, location: location } end |