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, #format, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ RBrace

Returns a new instance of RBrace.



8801
8802
8803
8804
# File 'lib/syntax_tree/node.rb', line 8801

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

Instance Attribute Details

#valueObject (readonly)

String

the right brace



8799
8800
8801
# File 'lib/syntax_tree/node.rb', line 8799

def value
  @value
end

Instance Method Details

#===(other) ⇒ Object



8827
8828
8829
# File 'lib/syntax_tree/node.rb', line 8827

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

#accept(visitor) ⇒ Object



8806
8807
8808
# File 'lib/syntax_tree/node.rb', line 8806

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

#child_nodesObject Also known as: deconstruct



8810
8811
8812
# File 'lib/syntax_tree/node.rb', line 8810

def child_nodes
  []
end

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



8814
8815
8816
8817
8818
8819
# File 'lib/syntax_tree/node.rb', line 8814

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

#deconstruct_keys(_keys) ⇒ Object



8823
8824
8825
# File 'lib/syntax_tree/node.rb', line 8823

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