Class: SyntaxTree::LabelEnd
Overview
LabelEnd represents the end of a dynamic symbol.
{ "key": value }
In the example above, LabelEnd represents the “":” token at the end of the hash key. This node is important for determining the type of quote being used by the label.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the end of the label.
Attributes inherited from Node
Instance Method Summary collapse
- #===(other) ⇒ Object
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #copy(value: nil, location: nil) ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(value:, location:) ⇒ LabelEnd
constructor
A new instance of LabelEnd.
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ LabelEnd
Returns a new instance of LabelEnd.
7110 7111 7112 7113 |
# File 'lib/syntax_tree/node.rb', line 7110 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the end of the label
7108 7109 7110 |
# File 'lib/syntax_tree/node.rb', line 7108 def value @value end |
Instance Method Details
#===(other) ⇒ Object
7136 7137 7138 |
# File 'lib/syntax_tree/node.rb', line 7136 def ===(other) other.is_a?(LabelEnd) && value === other.value end |
#accept(visitor) ⇒ Object
7115 7116 7117 |
# File 'lib/syntax_tree/node.rb', line 7115 def accept(visitor) visitor.visit_label_end(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7119 7120 7121 |
# File 'lib/syntax_tree/node.rb', line 7119 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
7123 7124 7125 7126 7127 7128 |
# File 'lib/syntax_tree/node.rb', line 7123 def copy(value: nil, location: nil) LabelEnd.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
7132 7133 7134 |
# File 'lib/syntax_tree/node.rb', line 7132 def deconstruct_keys(_keys) { value: value, location: location } end |