class SyntaxTree::StringConcat
StringConcat
represents concatenating two strings together using a backward slash.
"first" \ "second"
Attributes
left[R]
Heredoc
|StringConcat
|StringLiteral
-
the left side of the
concatenation
right[R]
StringLiteral
-
the right side of the concatenation
Public Class Methods
new(left:, right:, location:)
click to toggle source
# File lib/syntax_tree/node.rb, line 10135 def initialize(left:, right:, location:) @left = left @right = right @location = location @comments = [] end
Public Instance Methods
===(other)
click to toggle source
# File lib/syntax_tree/node.rb, line 10179 def ===(other) other.is_a?(StringConcat) && left === other.left && right === other.right end
accept(visitor)
click to toggle source
# File lib/syntax_tree/node.rb, line 10142 def accept(visitor) visitor.visit_string_concat(self) end
child_nodes()
click to toggle source
# File lib/syntax_tree/node.rb, line 10146 def child_nodes [left, right] end
Also aliased as: deconstruct
copy(left: nil, right: nil, location: nil)
click to toggle source
# File lib/syntax_tree/node.rb, line 10150 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
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/node.rb, line 10164 def deconstruct_keys(_keys) { left: left, right: right, location: location, comments: comments } end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 10168 def format(q) q.group do q.format(left) q.text(" \\") q.indent do q.breakable_force q.format(right) end end end