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.



8760
8761
8762
8763
# File 'lib/syntax_tree/node.rb', line 8760

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

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the array literal



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

def value
  @value
end

Instance Method Details

#===(other) ⇒ Object



8786
8787
8788
# File 'lib/syntax_tree/node.rb', line 8786

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

#accept(visitor) ⇒ Object



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

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

#child_nodesObject Also known as: deconstruct



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

def child_nodes
  []
end

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



8773
8774
8775
8776
8777
8778
# File 'lib/syntax_tree/node.rb', line 8773

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

#deconstruct_keys(_keys) ⇒ Object



8782
8783
8784
# File 'lib/syntax_tree/node.rb', line 8782

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