Class: SyntaxTree::TStringBeg

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

Overview

TStringBeg represents the beginning of a string literal.

"string"

In the example above, TStringBeg represents the first set of quotes. Strings can also use single quotes. They can also be declared using the %q and %Q syntax, as in:

%q{string}

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

Returns a new instance of TStringBeg.



8839
8840
8841
8842
# File 'lib/syntax_tree/node.rb', line 8839

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

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the string



8837
8838
8839
# File 'lib/syntax_tree/node.rb', line 8837

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



8844
8845
8846
# File 'lib/syntax_tree/node.rb', line 8844

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

#child_nodesObject Also known as: deconstruct



8848
8849
8850
# File 'lib/syntax_tree/node.rb', line 8848

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



8854
8855
8856
# File 'lib/syntax_tree/node.rb', line 8854

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