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

#construct_keys, #format, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ Comma

Returns a new instance of Comma.



2882
2883
2884
2885
# File 'lib/syntax_tree/node.rb', line 2882

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

Instance Attribute Details

#valueObject (readonly)

String

the comma in the string



2880
2881
2882
# File 'lib/syntax_tree/node.rb', line 2880

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



2887
2888
2889
# File 'lib/syntax_tree/node.rb', line 2887

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

#child_nodesObject Also known as: deconstruct



2891
2892
2893
# File 'lib/syntax_tree/node.rb', line 2891

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



2897
2898
2899
# File 'lib/syntax_tree/node.rb', line 2897

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