class Athena::ORM::ArrayCollection(T)
inherits Athena::ORM::BaseCollection
#
A simple wrapper around Array implementing the AORM::Collection interface.
Collection fields are initialized with an empty one; see AORM::Collection for how the ORM manages them from there.
property groups : AORM::Collection(Group) = AORM::ArrayCollection(Group).new
It has no ties to the ORM, so it's also suitable for building up a collection before assigning it to an entity.
Included modules
Athena::ORM::Collection
Indexable
Constructors#
Methods#
#[]?(index : Int) : T | Nil#
Returns the element at the given index, or nil if out of bounds.
#delete(element : T) : T | Nil#
Removes every occurrence of element from the collection. Returns the removed element, or nil if not found.
#remove_element(element : T) : Bool#
Removes every occurrence of element, and returns whether it was present.
#unsafe_fetch(index : Int) : T#
Returns the element at the given index, without doing any bounds check.