Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.

[1, 2, 3]
^^^^^^^^^
Attributes
Read

Represent the list of zero or more [non-void expressions](github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression) within the array.

Class Methods

Initialize a new ArrayNode node.

Return a symbol representation of this node type. See ‘Node::type`.

Instance Methods

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

def accept: (Visitor visitor) -> void

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

def closing: () -> String?

Represents the optional source location for the closing token.

[1,2,3]                 # "]"
%w[foo bar baz]         # "]"
%I(apple orange banana) # ")"
foo = 1, 2, 3           # nil

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

def contains_splat?: () -> bool

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array, ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayNode

An alias for child_nodes

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, elements: Array, opening_loc: Location?, closing_loc: Location? }

def inspect -> String

def opening: () -> String?

Represents the optional source location for the opening token.

[1,2,3]                 # "["
%w[foo bar baz]         # "%w["
%I(apple orange banana) # "%I("
foo = 1, 2, 3           # nil

Save the closing_loc location using the given saved source so that it can be retrieved later.

Save the opening_loc location using the given saved source so that it can be retrieved later.

Return a symbol representation of this node type. See ‘Node#type`.