Class: SyntaxTree::RBrace
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::RBrace
show all
- Defined in:
- lib/syntax_tree/node.rb
Overview
RBrace represents the use of a right brace, 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:) ⇒ RBrace
Returns a new instance of RBrace.
8932
8933
8934
8935
|
# File 'lib/syntax_tree/node.rb', line 8932
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
8930
8931
8932
|
# File 'lib/syntax_tree/node.rb', line 8930
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
8958
8959
8960
|
# File 'lib/syntax_tree/node.rb', line 8958
def ===(other)
other.is_a?(RBrace) && value === other.value
end
|
#accept(visitor) ⇒ Object
8937
8938
8939
|
# File 'lib/syntax_tree/node.rb', line 8937
def accept(visitor)
visitor.visit_rbrace(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
8941
8942
8943
|
# File 'lib/syntax_tree/node.rb', line 8941
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
8945
8946
8947
8948
8949
8950
|
# File 'lib/syntax_tree/node.rb', line 8945
def copy(value: nil, location: nil)
RBrace.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
8954
8955
8956
|
# File 'lib/syntax_tree/node.rb', line 8954
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|