Class: SyntaxTree::QSymbolsBeg

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

QSymbolsBeg represents the beginning of a symbol literal array.

%i[one two three]

In the snippet above, QSymbolsBeg represents the “%i[” token. Note that these kinds of arrays can start with a lot of different delimiter types (e.g., %i| or %i<).

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:) ⇒ QSymbolsBeg

Returns a new instance of QSymbolsBeg.



8727
8728
8729
8730
# File 'lib/syntax_tree/node.rb', line 8727

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

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the array literal



8725
8726
8727
# File 'lib/syntax_tree/node.rb', line 8725

def value
  @value
end

Instance Method Details

#===(other) ⇒ Object



8753
8754
8755
# File 'lib/syntax_tree/node.rb', line 8753

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

#accept(visitor) ⇒ Object



8732
8733
8734
# File 'lib/syntax_tree/node.rb', line 8732

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

#child_nodesObject Also known as: deconstruct



8736
8737
8738
# File 'lib/syntax_tree/node.rb', line 8736

def child_nodes
  []
end

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



8740
8741
8742
8743
8744
8745
# File 'lib/syntax_tree/node.rb', line 8740

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

#deconstruct_keys(_keys) ⇒ Object



8749
8750
8751
# File 'lib/syntax_tree/node.rb', line 8749

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