class

Crystal::Macros::ArrayLiteral

Inherits Crystal::Macros::ASTNode

An array literal.

Instance methods

*(other : NumberLiteral) : ArrayLiteral

Similar to Array#*

Source
+(other : ArrayLiteral) : ArrayLiteral

Similar to Array#+.

Source
-(other : ArrayLiteral) : ArrayLiteral

Similar to Array#-.

Source
<<(value : ASTNode) : ArrayLiteral

Similar to Array#<<.

Source
[](start : NumberLiteral, count : NumberLiteral) : ArrayLiteral(ASTNode) | NilLiteral

Similar to Array#[]?(Int, Int).

Source
[](index : NumberLiteral) : ASTNode

Similar to Array#[]?(Int).

Source
[](index : RangeLiteral) : ArrayLiteral(ASTNode) | NilLiteral

Similar to Array#[]?(Range).

Source
[]=(index : NumberLiteral, value : ASTNode) : ASTNode

Similar to Array#[]=.

Source
all?

Similar to Enumerable#all?

Source
any?

Similar to Enumerable#any?

Source
clear

Similar to Array#clear

Source
each

Similar to Array#each

Source
each_with_index

Similar to Enumerable#each_with_index

Source
empty?

Similar to Array#empty?

Source
find

Similar to Enumerable#find

Source
first

Similar to Array#first, but returns a NilLiteral if the array is empty.

Source
includes?(node : ASTNode) : BoolLiteral

Similar to Enumerable#includes?(obj).

Source
join(separator) : StringLiteral

Similar to Enumerable#join

Source
last

Similar to Array#last, but returns a NilLiteral if the array is empty.

Source
map

Similar to Enumerable#map

Source
map_with_index

Similar to Enumerable#map_with_index

Source
of

Returns the type specified at the end of the array literal, if any.

This refers to the part after brackets in [] of String.

Source
push(value : ASTNode) : ArrayLiteral

Similar to Array#push.

Source
reduce(memo : ASTNode, &) : ASTNode

Similar to Enumerable#reduce

Source
reduce

Similar to Enumerable#reduce

Source
reject

Similar to Enumerable#reject

Source
select

Similar to Enumerable#select

Source
shuffle

Similar to Array#shuffle

Source
size

Similar to Array#size

Source
sort

Similar to Array#sort

Source
sort_by

Similar to Array#sort_by

Source
splat(trailing_string : StringLiteral = nil) : MacroId

Returns a MacroId with all of this array's elements joined by commas.

If trailing_string is given, it will be appended to the result unless this array is empty. This lets you splat an array and optionally write a trailing comma if needed.

Source
type

Returns the type that receives the items of the array.

This refers to the part before brackets in MyArray{1, 2, 3}

Source
uniq

Similar to Array#uniq

Source
unshift(value : ASTNode) : ArrayLiteral

Similar to Array#unshift.

Source