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, #format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ RBracket
Returns a new instance of RBracket.
8837
8838
8839
8840
|
# File 'lib/syntax_tree/node.rb', line 8837
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
8835
8836
8837
|
# File 'lib/syntax_tree/node.rb', line 8835
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
8863
8864
8865
|
# File 'lib/syntax_tree/node.rb', line 8863
def ===(other)
other.is_a?(RBracket) && value === other.value
end
|
#accept(visitor) ⇒ Object
8842
8843
8844
|
# File 'lib/syntax_tree/node.rb', line 8842
def accept(visitor)
visitor.visit_rbracket(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
8846
8847
8848
|
# File 'lib/syntax_tree/node.rb', line 8846
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
8850
8851
8852
8853
8854
8855
|
# File 'lib/syntax_tree/node.rb', line 8850
def copy(value: nil, location: nil)
RBracket.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
8859
8860
8861
|
# File 'lib/syntax_tree/node.rb', line 8859
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|