class SyntaxTree::XStringLiteral

XStringLiteral represents a string that gets executed.

`ls`

Attributes

comments[R]
Array[ Comment | EmbDoc ]

the comments attached to this node

parts[R]
Array[ StringEmbExpr | StringDVar | TStringContent ]

the parts of the

xstring

Public Class Methods

new(parts:, location:) click to toggle source
# File lib/syntax_tree/node.rb, line 12227
def initialize(parts:, location:)
  @parts = parts
  @location = location
  @comments = []
end

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 12264
def ===(other)
  other.is_a?(XStringLiteral) && ArrayMatch.call(parts, other.parts)
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 12233
def accept(visitor)
  visitor.visit_xstring_literal(self)
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 12237
def child_nodes
  parts
end
Also aliased as: deconstruct
copy(parts: nil, location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 12241
def copy(parts: nil, location: nil)
  node =
    XStringLiteral.new(
      parts: parts || self.parts,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end
deconstruct()
Alias for: child_nodes
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/node.rb, line 12254
def deconstruct_keys(_keys)
  { parts: parts, location: location, comments: comments }
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 12258
def format(q)
  q.text("`")
  q.format_each(parts)
  q.text("`")
end