class SyntaxTree::StringConcat
StringConcat
represents concatenating two strings together using a backward slash.
"first" \ "second"
Attributes
Heredoc
|StringConcat
|StringLiteral
-
the left side of the
concatenation
StringLiteral
-
the right side of the concatenation
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 10150 def initialize(left:, right:, location:) @left = left @right = right @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 10194 def ===(other) other.is_a?(StringConcat) && left === other.left && right === other.right end
Source
# File lib/syntax_tree/node.rb, line 10157 def accept(visitor) visitor.visit_string_concat(self) end
Source
# File lib/syntax_tree/node.rb, line 10161 def child_nodes [left, right] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 10165 def copy(left: nil, right: nil, location: nil) node = StringConcat.new( left: left || self.left, right: right || self.right, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
Source
# File lib/syntax_tree/node.rb, line 10179 def deconstruct_keys(_keys) { left: left, right: right, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 10183 def format(q) q.group do q.format(left) q.text(" \\") q.indent do q.breakable_force q.format(right) end end end