class SyntaxTree::MRHS

MRHS represents the values that are being assigned on the right-hand side of a multiple assignment.

values = first, second, third

Attributes

comments[R]
Array[ Comment | EmbDoc ]

the comments attached to this node

parts[R]
Array

the parts that are being assigned

Public Class Methods

new(parts:, location:) click to toggle source
# File lib/syntax_tree/node.rb, line 7876
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 7911
def ===(other)
  other.is_a?(MRHS) && ArrayMatch.call(parts, other.parts)
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 7882
def accept(visitor)
  visitor.visit_mrhs(self)
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 7886
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 7890
def copy(parts: nil, location: nil)
  node =
    MRHS.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 7903
def deconstruct_keys(_keys)
  { parts: parts, location: location, comments: comments }
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 7907
def format(q)
  q.seplist(parts) { |part| q.format(part) }
end