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.



2481
2482
2483
2484
# File 'lib/syntax_tree/node.rb', line 2481

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

Instance Attribute Details

#valueObject (readonly)

String

the comma in the string



2479
2480
2481
# File 'lib/syntax_tree/node.rb', line 2479

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



2486
2487
2488
# File 'lib/syntax_tree/node.rb', line 2486

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

#child_nodesObject Also known as: deconstruct



2490
2491
2492
# File 'lib/syntax_tree/node.rb', line 2490

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



2496
2497
2498
# File 'lib/syntax_tree/node.rb', line 2496

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