Class: SyntaxTree::ERB::CharData
- Defined in:
- lib/syntax_tree/erb/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.
473 474 475 476 |
# File 'lib/syntax_tree/erb/nodes.rb', line 473 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
471 472 473 |
# File 'lib/syntax_tree/erb/nodes.rb', line 471 def location @location end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
471 472 473 |
# File 'lib/syntax_tree/erb/nodes.rb', line 471 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
478 479 480 |
# File 'lib/syntax_tree/erb/nodes.rb', line 478 def accept(visitor) visitor.visit_char_data(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
482 483 484 |
# File 'lib/syntax_tree/erb/nodes.rb', line 482 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
488 489 490 |
# File 'lib/syntax_tree/erb/nodes.rb', line 488 def deconstruct_keys(keys) { value: value, location: location } end |