Class: SyntaxTree::XString

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

Overview

XString represents the contents of an XStringLiteral.

`ls`

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(parts:, location:) ⇒ XString

Returns a new instance of XString.



9984
9985
9986
9987
# File 'lib/syntax_tree/node.rb', line 9984

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

Instance Attribute Details

#parts ⇒ Object (readonly)

[Array[ StringEmbExpr | StringDVar | TStringContent ]] the parts of the xstring



9982
9983
9984
# File 'lib/syntax_tree/node.rb', line 9982

def parts
  @parts
end

Instance Method Details

#accept(visitor) ⇒ Object



9989
9990
9991
# File 'lib/syntax_tree/node.rb', line 9989

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

#child_nodes ⇒ Object Also known as: deconstruct



9993
9994
9995
# File 'lib/syntax_tree/node.rb', line 9993

def child_nodes
  parts
end

#deconstruct_keys(_keys) ⇒ Object



9999
10000
10001
# File 'lib/syntax_tree/node.rb', line 9999

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