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
3340
3341
3342
3343
|
# File 'lib/syntax_tree/node.rb', line 3340
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the comma in the string
3338
3339
3340
|
# File 'lib/syntax_tree/node.rb', line 3338
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
3363
3364
3365
|
# File 'lib/syntax_tree/node.rb', line 3363
def ===(other)
other.is_a?(Comma) && value === other.value
end
|
#accept(visitor) ⇒ Object
3345
3346
3347
|
# File 'lib/syntax_tree/node.rb', line 3345
def accept(visitor)
visitor.visit_comma(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
3349
3350
3351
|
# File 'lib/syntax_tree/node.rb', line 3349
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
3353
3354
3355
|
# File 'lib/syntax_tree/node.rb', line 3353
def copy(value: nil, location: nil)
Comma.new(value: value || self.value, location: location || self.location)
end
|
#deconstruct_keys(_keys) ⇒ Object
3359
3360
3361
|
# File 'lib/syntax_tree/node.rb', line 3359
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|