Array::Wrapper(T)
Inherits Wrapper < Indexable < Enumerable < Iterable < Comparable
Wraps an Array object. The including type will behave as a read-only
array, where objects returned by methods will be wrapped as well if
the return type is the same as the original array.
class CustomArray(T)
include ArrayWrapper(T)
end
arr = CustomArray.new([1, 2, 3, 4])
arr.size # => 4
arr[0]? # => 1
arr[6]? # => nil
arr.select(&.even?) # => [2, 4]
arr.select(&.even?).class # => CustomArray(Int32)
arr.select!(&.even?) # does not compile
Constructors
Instance methods
&(*args, **options)
Source&(*args, **options, &)
Source*(*args, **options)
Source*(*args, **options, &)
Source+(*args, **options)
Source+(*args, **options, &)
Source-(*args, **options)
Source-(*args, **options, &)
Source<=>(rhs : self) : Int32
Source<=>(*args, **options)
Source<=>(*args, **options, &)
Source[](*args, **options)
Source[](*args, **options, &)
Source[]?(*args, **options)
Source[]?(*args, **options, &)
Source|(*args, **options)
Source|(*args, **options, &)
Sourcecompact(*args, **options)
Sourcecompact(*args, **options, &)
Sourceeach_repeated_permutation(*args, **options)
Sourceeach_repeated_permutation(*args, **options, &)
SourceInvokes Array#[]each_slice(n, reuse) on the enclosed array,
yielding a wrapped array each time.
first(*args, **options)
Sourcefirst(*args, **options, &)
Sourceflatten(*args, **options)
Sourceflatten(*args, **options, &)
Sourcegroup_by
Returns the result of calling Array#group_by(&) on the enclosed
array with the hash's values wrapped.
index(*args, **options)
Sourceindex(*args, **options, &)
Sourceinspect(io : IO) : Nil
Sourcelast(*args, **options)
Sourcelast(*args, **options, &)
Sourcemap(*args, **options)
Sourcemap(*args, **options, &)
Sourcemap_with_index(*args, **options)
Sourcemap_with_index(*args, **options, &)
Sourcereject(*args, **options)
Sourcereject(*args, **options, &)
Sourceremaining_capacity(*args, **options)
Sourceremaining_capacity(*args, **options, &)
Sourcerepeated_permutations(*args, **options)
Sourcerepeated_permutations(*args, **options, &)
Sourcereverse(*args, **options)
Sourcereverse(*args, **options, &)
Sourcerotate(*args, **options)
Sourcerotate(*args, **options, &)
Sourcesample(*args, **options)
Sourcesample(*args, **options, &)
Sourceselect(*args, **options)
Sourceselect(*args, **options, &)
Sourceshuffle(*args, **options)
Sourceshuffle(*args, **options, &)
Sourcesize(*args, **options)
Sourcesize(*args, **options, &)
Sourceskip(*args, **options)
Sourceskip(*args, **options, &)
Sourceskip_while(*args, **options)
Sourceskip_while(*args, **options, &)
Sourcesort(*args, **options)
Sourcesort(*args, **options, &)
Sourcesort_by(*args, **options)
Sourcesort_by(*args, **options, &)
Sourcetake_while(*args, **options)
Sourcetake_while(*args, **options, &)
Sourceto_s(*args, **options)
Sourceto_s(*args, **options, &)
Sourcetranspose(*args, **options)
Sourcetranspose(*args, **options, &)
Sourceuniq(*args, **options)
Sourceuniq(*args, **options, &)
Sourceunsafe_fetch(*args, **options)
Sourceunsafe_fetch(*args, **options, &)
Sourceunstable_sort(*args, **options)
Sourceunstable_sort(*args, **options, &)
Sourceunstable_sort_by(*args, **options)
Sourceunstable_sort_by(*args, **options, &)
Source