Class: SyntaxTree::RBrace

Inherits:
Node
  • Object
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.



8965
8966
8967
8968
# File 'lib/syntax_tree/node.rb', line 8965

def initialize(value:, location:)
  @value = value
  @location = location
end

Instance Attribute Details

#valueObject (readonly)

String

the right brace



8963
8964
8965
# File 'lib/syntax_tree/node.rb', line 8963

def value
  @value
end

Instance Method Details

#===(other) ⇒ Object



8991
8992
8993
# File 'lib/syntax_tree/node.rb', line 8991

def ===(other)
  other.is_a?(RBrace) && value === other.value
end

#accept(visitor) ⇒ Object



8970
8971
8972
# File 'lib/syntax_tree/node.rb', line 8970

def accept(visitor)
  visitor.visit_rbrace(self)
end

#child_nodesObject Also known as: deconstruct



8974
8975
8976
# File 'lib/syntax_tree/node.rb', line 8974

def child_nodes
  []
end

#copy(value: nil, location: nil) ⇒ Object



8978
8979
8980
8981
8982
8983
# File 'lib/syntax_tree/node.rb', line 8978

def copy(value: nil, location: nil)
  RBrace.new(
    value: value || self.value,
    location: location || self.location
  )
end

#deconstruct_keys(_keys) ⇒ Object



8987
8988
8989
# File 'lib/syntax_tree/node.rb', line 8987

def deconstruct_keys(_keys)
  { value: value, location: location }
end