Class: SyntaxTree::QWordsBeg

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

Overview

QWordsBeg represents the beginning of a string literal array.

%w[one two three]

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

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

Returns a new instance of QWordsBeg.



7007
7008
7009
7010
# File 'lib/syntax_tree/node.rb', line 7007

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

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the array literal



7005
7006
7007
# File 'lib/syntax_tree/node.rb', line 7005

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7012
7013
7014
# File 'lib/syntax_tree/node.rb', line 7012

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

#child_nodesObject Also known as: deconstruct



7016
7017
7018
# File 'lib/syntax_tree/node.rb', line 7016

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



7022
7023
7024
# File 'lib/syntax_tree/node.rb', line 7022

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