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::ArrayPatternNode

< Prism::Node 16 instance methods 2 class methods

Represents an array pattern in pattern matching.

foo in 1, 2
^^^^^^^^^^^

foo in [1, 2]
^^^^^^^^^^^^^

foo in *bar
^^^^^^^^^^^

foo in Bar[]
^^^^^^^^^^^^

foo in Bar[1, 2, 3]
^^^^^^^^^^^^^^^^^^^

Class methods 2

Instance methods 16

Attributes
Read

attr_reader constant: ConstantReadNode | ConstantPathNode | nil

Read

Represents the elements after the rest element of the array pattern.

foo in *bar, baz
             ^^^
Read

Represents the required elements of the array pattern.

foo in [1, 2]
        ^  ^
Read

Represents the rest element of the array pattern.

foo in *bar
       ^^^^