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, #format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ Comma
Returns a new instance of Comma.
3373
3374
3375
3376
|
# File 'lib/syntax_tree/node.rb', line 3373
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the comma in the string
3371
3372
3373
|
# File 'lib/syntax_tree/node.rb', line 3371
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
3396
3397
3398
|
# File 'lib/syntax_tree/node.rb', line 3396
def ===(other)
other.is_a?(Comma) && value === other.value
end
|
#accept(visitor) ⇒ Object
3378
3379
3380
|
# File 'lib/syntax_tree/node.rb', line 3378
def accept(visitor)
visitor.visit_comma(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
3382
3383
3384
|
# File 'lib/syntax_tree/node.rb', line 3382
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
3386
3387
3388
|
# File 'lib/syntax_tree/node.rb', line 3386
def copy(value: nil, location: nil)
Comma.new(value: value || self.value, location: location || self.location)
end
|
#deconstruct_keys(_keys) ⇒ Object
3392
3393
3394
|
# File 'lib/syntax_tree/node.rb', line 3392
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|