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 lib/yarp/node.rb, line 8257 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 lib/yarp/node.rb, line 8265 def accept(visitor) visitor.visit_multi_target_node(self) end
child_nodes()
click to toggle source
def child_nodes
: () -> Array[nil | Node]
# File lib/yarp/node.rb, line 8270 def child_nodes [*targets] end
Also aliased as: deconstruct
comment_targets()
click to toggle source
def comment_targets
: () -> Array[Node | Location]
# File lib/yarp/node.rb, line 8280 def comment_targets [*targets, *lparen_loc, *rparen_loc] end
compact_child_nodes()
click to toggle source
def compact_child_nodes
: () -> Array
# File lib/yarp/node.rb, line 8275 def compact_child_nodes [*targets] end
copy(**params)
click to toggle source
def copy: (**params) -> MultiTargetNode
# File lib/yarp/node.rb, line 8285 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_keys(keys)
click to toggle source
def deconstruct_keys
: (keys: Array) -> Hash[Symbol, nil | Node | Array | String
| Token | Array | Location]
# File lib/yarp/node.rb, line 8298 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 lib/yarp/node.rb, line 8312 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 lib/yarp/node.rb, line 8303 def lparen lparen_loc&.slice end
rparen()
click to toggle source
def rparen: () -> String
?
# File lib/yarp/node.rb, line 8308 def rparen rparen_loc&.slice end