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

#format, #pretty_print, #to_json

Constructor Details

#initialize(parts:, location:) ⇒ XString

Returns a new instance of XString.



9760
9761
9762
9763
# File 'lib/syntax_tree/node.rb', line 9760

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

Instance Attribute Details

#partsObject (readonly)

Array[ StringEmbExpr | StringDVar | TStringContent ]

the parts of the

xstring



9758
9759
9760
# File 'lib/syntax_tree/node.rb', line 9758

def parts
  @parts
end

Instance Method Details

#accept(visitor) ⇒ Object



9765
9766
9767
# File 'lib/syntax_tree/node.rb', line 9765

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

#child_nodesObject Also known as: deconstruct



9769
9770
9771
# File 'lib/syntax_tree/node.rb', line 9769

def child_nodes
  parts
end

#deconstruct_keys(keys) ⇒ Object



9775
9776
9777
# File 'lib/syntax_tree/node.rb', line 9775

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