Class: SyntaxTree::SymbolsBeg

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

Overview

SymbolsBeg represents the start of a symbol array literal with interpolation.

%I[one two three]

In the snippet above, SymbolsBeg 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

#format, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ SymbolsBeg

Returns a new instance of SymbolsBeg.



8442
8443
8444
8445
# File 'lib/syntax_tree/node.rb', line 8442

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

Instance Attribute Details

#value ⇒ Object (readonly)

[String] the beginning of the symbol literal array



8440
8441
8442
# File 'lib/syntax_tree/node.rb', line 8440

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



8447
8448
8449
# File 'lib/syntax_tree/node.rb', line 8447

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

#child_nodes ⇒ Object Also known as: deconstruct



8451
8452
8453
# File 'lib/syntax_tree/node.rb', line 8451

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



8457
8458
8459
# File 'lib/syntax_tree/node.rb', line 8457

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