class YARP::MultiTargetNode

Represents a multi-target expression.

a, b, c = 1, 2, 3
^^^^^^^

Attributes

lparen_loc[R]

attr_reader lparen_loc: Location?

rparen_loc[R]

attr_reader rparen_loc: Location?

targets[R]

attr_reader targets: Array

Public Class Methods

new(targets, lparen_loc, rparen_loc, location) click to toggle source

def initialize: (targets: Array, lparen_loc: Location?, rparen_loc: Location?, location: Location) -> void

# File yarp/node.rb, line 7562
def initialize(targets, lparen_loc, rparen_loc, location)
  @targets = targets
  @lparen_loc = lparen_loc
  @rparen_loc = rparen_loc
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

# File yarp/node.rb, line 7570
def accept(visitor)
  visitor.visit_multi_target_node(self)
end
child_nodes() click to toggle source

def child_nodes: () -> Array[nil | Node]

# File yarp/node.rb, line 7575
def child_nodes
  [*targets]
end
Also aliased as: deconstruct
comment_targets() click to toggle source

def comment_targets: () -> Array[Node | Location]

# File yarp/node.rb, line 7580
def comment_targets
  [*targets, *lparen_loc, *rparen_loc]
end
copy(**params) click to toggle source

def copy: (**params) -> MultiTargetNode

# File yarp/node.rb, line 7585
def copy(**params)
  MultiTargetNode.new(
    params.fetch(:targets) { targets },
    params.fetch(:lparen_loc) { lparen_loc },
    params.fetch(:rparen_loc) { rparen_loc },
    params.fetch(:location) { location },
  )
end
deconstruct()

def deconstruct: () -> Array[nil | Node]

Alias for: child_nodes
deconstruct_keys(keys) click to toggle source

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]

# File yarp/node.rb, line 7598
def deconstruct_keys(keys)
  { targets: targets, lparen_loc: lparen_loc, rparen_loc: rparen_loc, location: location }
end
inspect(inspector = NodeInspector.new) click to toggle source
# File yarp/node.rb, line 7612
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector << "├── targets: #{inspector.list("#{inspector.prefix}│   ", targets)}"
  inspector << "├── lparen_loc: #{inspector.location(lparen_loc)}\n"
  inspector << "└── rparen_loc: #{inspector.location(rparen_loc)}\n"
  inspector.to_str
end
lparen() click to toggle source

def lparen: () -> String?

# File yarp/node.rb, line 7603
def lparen
  lparen_loc&.slice
end
rparen() click to toggle source

def rparen: () -> String?

# File yarp/node.rb, line 7608
def rparen
  rparen_loc&.slice
end