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.



2904
2905
2906
2907
# File 'lib/syntax_tree/node.rb', line 2904

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

Instance Attribute Details

#value ⇒ Object (readonly)

[String] the comma in the string



2902
2903
2904
# File 'lib/syntax_tree/node.rb', line 2902

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



2909
2910
2911
# File 'lib/syntax_tree/node.rb', line 2909

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

#child_nodes ⇒ Object Also known as: deconstruct



2913
2914
2915
# File 'lib/syntax_tree/node.rb', line 2913

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



2919
2920
2921
# File 'lib/syntax_tree/node.rb', line 2919

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