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

Constructor Details

#initialize(value:, location:) ⇒ QSymbolsBeg

Returns a new instance of QSymbolsBeg.



8596
8597
8598
8599
# File 'lib/syntax_tree/node.rb', line 8596

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

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the array literal



8594
8595
8596
# File 'lib/syntax_tree/node.rb', line 8594

def value
  @value
end

Instance Method Details

#===(other) ⇒ Object



8622
8623
8624
# File 'lib/syntax_tree/node.rb', line 8622

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

#accept(visitor) ⇒ Object



8601
8602
8603
# File 'lib/syntax_tree/node.rb', line 8601

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

#child_nodesObject Also known as: deconstruct



8605
8606
8607
# File 'lib/syntax_tree/node.rb', line 8605

def child_nodes
  []
end

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



8609
8610
8611
8612
8613
8614
# File 'lib/syntax_tree/node.rb', line 8609

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

#deconstruct_keys(_keys) ⇒ Object



8618
8619
8620
# File 'lib/syntax_tree/node.rb', line 8618

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