Class: SyntaxTree::LabelEnd

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

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

Attributes inherited from Node

#location

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ LabelEnd

Returns a new instance of LabelEnd.



5772
5773
5774
5775
# File 'lib/syntax_tree/node.rb', line 5772

def initialize(value:, location:)
  @value = value
  @location = location
end

Instance Attribute Details

#valueObject (readonly)

String

the end of the label



5770
5771
5772
# File 'lib/syntax_tree/node.rb', line 5770

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



5777
5778
5779
# File 'lib/syntax_tree/node.rb', line 5777

def accept(visitor)
  visitor.visit_label_end(self)
end

#child_nodesObject Also known as: deconstruct



5781
5782
5783
# File 'lib/syntax_tree/node.rb', line 5781

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



5787
5788
5789
# File 'lib/syntax_tree/node.rb', line 5787

def deconstruct_keys(keys)
  { value: value, location: location }
end