Class: SyntaxTree::Comma

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

Overview

Comma represents the use of the , operator.

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:) ⇒ Comma

Returns a new instance of Comma.



2825
2826
2827
2828
# File 'lib/syntax_tree/node.rb', line 2825

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

Instance Attribute Details

#valueObject (readonly)

String

the comma in the string



2823
2824
2825
# File 'lib/syntax_tree/node.rb', line 2823

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



2830
2831
2832
# File 'lib/syntax_tree/node.rb', line 2830

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

#child_nodesObject Also known as: deconstruct



2834
2835
2836
# File 'lib/syntax_tree/node.rb', line 2834

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



2840
2841
2842
# File 'lib/syntax_tree/node.rb', line 2840

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