Squirrel::Template::Expr::WrapArray - provide virtual methods for arrays
somearray.size sorted = somearray.sort() sorted = somearray.sort(key) reversed = somearray.reverse joined = somearray.join() joined = somearray.join(":") last = somearray.last first = somearray.first first = somearray.shift # modifies somearray somearray.push(avalue); last = somearray.pop # modifies somearray somearray.unshift(avalue); somearray.is_list # always true somearray.is_hash # always false
This class provides virtual methods for arrays (well, array references) in the Squirrel::Template manpage's expression language.
The number of elements in the list.
sorted()
The elements sorted by name.
The elements sorted as objects calling fieldname
.
The elements in reverse order.
join()
A string with the elements concatenated together.
A string with the elements concatenated together, separated by sep
.
The last element in the array, or undef.
The first element in the array, or undef.
Remove the first element from the list and return that.
Add the given elements to the end of the array. returns the new size of the array.
Remove the last element from the list and return that.
Add the given elements to the start of the array. returns the new size of the array.
Return a new array with any contained arrays expanded one level.
[ [ [ 1 ], 2 ], 3 ].expand => [ [ 1 ], 2, 3 ]
Set the specified index in the array to value. Returns value.
Test if this object is a list. Always true for a list.
Test if this object is a hash. Always false for a list.
Test if this object is a code object. Always false for a list.
the Squirrel::Template::Expr manpage, the Squirrel::Template manpage
Tony Cook <tony@develop-help.com>