list |
class List < Object |
Public Methods |
Create a list
Create a list
Add a new element to the end of the list.
elem | The element to push. |
---|
Returns: self.
Remove an element from the end of the list.
Returns: the element that was removed, or nil if the list was empty.
Remove an element from the beginning of the list.
Returns: the element that was removed, or nil if the list was empty.
Insert a new element at the end of the list.
element | the element to insert. |
---|
Returns: self.
Create a shallow copy of the list.
Returns: the new list.
Iterate through all the elements of the list.
Returns: the last return value fromt the block given.
Iterate through all the elements of the list in reverse order.
Returns: the last return value fromt the block given.
Create a shallow copy of the list, with its elements in reverse order.
Returns: the new list.
Retrieve the first element from the list.
Returns: the first element of the list.
Retrieve the last element of the list.
Returns: the last element of the list.
Convert the list to a string.
Returns: a string representation of this list.
Convert the list to an array.
Returns: a new array holding references to the elements of the list.
Clear the list.
Returns: self.
Compare this array to another container. The other container must have the "each" method defined.
Returns: -1 if the list compares less than the other container, 1 if the list compares greater than the other container, or 0 if the containers compare equal.
Mixins |
Enumerable | |
---|---|
EnumerableContainer | |
SingleEnumerableContainer | |
SingleUpdatableContainer |