Skip to content
On this page

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class · Ruby 3.4

Prism::MultiTargetNode

< Prism::Node 16 instance methods 2 class methods

Represents a multi-target expression.

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

This can be a part of MultiWriteNode as above, or the target of a for loop

for a, b in [[1, 2], [3, 4]]
    ^^^^

Class methods 2

Instance methods 16

Attributes
Read

Represents the targets expressions before a splat node.

a, (b, c, *) = 1, 2, 3, 4, 5
    ^^^^

The splat node can be absent, in that case all target expressions are in the left field.

a, (b, c) = 1, 2, 3, 4, 5
    ^^^^
Read

Represents a splat node in the target expression.

a, (b, *c) = 1, 2, 3, 4
       ^^

The variable can be empty, this results in a SplatNode with a nil expression field.

a, (b, *) = 1, 2, 3, 4
       ^

If the ‘*` is omitted, this field will contain an ImplicitRestNode

a, (b,) = 1, 2, 3, 4
     ^
Read

Represents the targets expressions after a splat node.

a, (*, b, c) = 1, 2, 3, 4, 5
       ^^^^