Class: SyntaxTree::Comma
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::Comma
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, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ Comma
Returns a new instance of Comma.
3432
3433
3434
3435
|
# File 'lib/syntax_tree/node.rb', line 3432
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the comma in the string
3430
3431
3432
|
# File 'lib/syntax_tree/node.rb', line 3430
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
3455
3456
3457
|
# File 'lib/syntax_tree/node.rb', line 3455
def ===(other)
other.is_a?(Comma) && value === other.value
end
|
#accept(visitor) ⇒ Object
3437
3438
3439
|
# File 'lib/syntax_tree/node.rb', line 3437
def accept(visitor)
visitor.visit_comma(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
3441
3442
3443
|
# File 'lib/syntax_tree/node.rb', line 3441
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
3445
3446
3447
|
# File 'lib/syntax_tree/node.rb', line 3445
def copy(value: nil, location: nil)
Comma.new(value: value || self.value, location: location || self.location)
end
|
#deconstruct_keys(_keys) ⇒ Object
3451
3452
3453
|
# File 'lib/syntax_tree/node.rb', line 3451
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|