Class: SyntaxTree::RBracket
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::RBracket
show all
- Defined in:
- lib/syntax_tree/node.rb
Overview
RBracket represents the use of a right bracket, i.e., ].
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:) ⇒ RBracket
Returns a new instance of RBracket.
9000
9001
9002
9003
|
# File 'lib/syntax_tree/node.rb', line 9000
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
8998
8999
9000
|
# File 'lib/syntax_tree/node.rb', line 8998
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
9026
9027
9028
|
# File 'lib/syntax_tree/node.rb', line 9026
def ===(other)
other.is_a?(RBracket) && value === other.value
end
|
#accept(visitor) ⇒ Object
9005
9006
9007
|
# File 'lib/syntax_tree/node.rb', line 9005
def accept(visitor)
visitor.visit_rbracket(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
9009
9010
9011
|
# File 'lib/syntax_tree/node.rb', line 9009
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
9013
9014
9015
9016
9017
9018
|
# File 'lib/syntax_tree/node.rb', line 9013
def copy(value: nil, location: nil)
RBracket.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
9022
9023
9024
|
# File 'lib/syntax_tree/node.rb', line 9022
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|