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.



8744
8745
8746
8747
# File 'lib/syntax_tree/node.rb', line 8744

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

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the array literal



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

def value
  @value
end

Instance Method Details

#===(other) ⇒ Object



8770
8771
8772
# File 'lib/syntax_tree/node.rb', line 8770

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

#accept(visitor) ⇒ Object



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

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

#child_nodesObject Also known as: deconstruct



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

def child_nodes
  []
end

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



8757
8758
8759
8760
8761
8762
# File 'lib/syntax_tree/node.rb', line 8757

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

#deconstruct_keys(_keys) ⇒ Object



8766
8767
8768
# File 'lib/syntax_tree/node.rb', line 8766

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