Class: SyntaxTree::TStringEnd

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

Overview

TStringEnd represents the end of a string literal.

"string"

In the example above, TStringEnd represents the second 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:) ⇒ TStringEnd

Returns a new instance of TStringEnd.



8906
8907
8908
8909
# File 'lib/syntax_tree/node.rb', line 8906

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

Instance Attribute Details

#value ⇒ Object (readonly)

[String] the end of the string



8904
8905
8906
# File 'lib/syntax_tree/node.rb', line 8904

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



8911
8912
8913
# File 'lib/syntax_tree/node.rb', line 8911

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

#child_nodes ⇒ Object Also known as: deconstruct



8915
8916
8917
# File 'lib/syntax_tree/node.rb', line 8915

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



8921
8922
8923
# File 'lib/syntax_tree/node.rb', line 8921

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