struct Wraith::ArrayStore(T)
- Wraith::ArrayStore(T)
- Struct
- Value
- Object
Included Modules
Defined in:
wraithdb/stores/array_store.crConstructors
Instance Method Summary
- #<<(elem : T) : self
-
#==(other_array) : Bool
Returns
true
if this struct is equal to other. - #[](*args, **options)
- #[](*args, **options, &)
- #[]=(index : Int, value : T)
- #[]=(range : Range, value : T)
- #all?(*args, **options)
- #all?(*args, **options, &)
- #any?(*args, **options)
- #any?(*args, **options, &)
- #assign(new_array : Array(T))
- #compact(*args, **options)
- #compact(*args, **options, &)
- #compact! : self
- #count(*args, **options)
- #count(*args, **options, &)
- #delete(obj) : T | Nil
- #delete_at(index : Int) : self
- #each(*args, **options)
- #each(*args, **options, &)
- #each_with_index(*args, **options)
- #each_with_index(*args, **options, &)
- #first(*args, **options)
- #first(*args, **options, &)
- #index(*args, **options)
- #index(*args, **options, &)
- #join(*args, **options)
- #join(*args, **options, &)
- #last(*args, **options)
- #last(*args, **options, &)
- #map(*args, **options)
- #map(*args, **options, &)
- #max(*args, **options)
- #max(*args, **options, &)
- #min(*args, **options)
- #min(*args, **options, &)
- #minmax(*args, **options)
- #minmax(*args, **options, &)
- #pop : T
-
#push(value : T)
Append.
-
#push(*values : T) : self
Append multiple values.
- #reject(*args, **options)
- #reject(*args, **options, &)
-
#reject!(& : T -> ) : self
Modifies
self
, deleting the elements in the collection for which the passed block returnstrue
. -
#reject!(pattern) : self
Modifies
self
, deleting the elements in the collection for whichpattern === element
. - #reverse(*args, **options)
- #reverse(*args, **options, &)
- #reverse! : self
- #sample(*args, **options)
- #sample(*args, **options, &)
- #select(*args, **options)
- #select(*args, **options, &)
- #shift : T
- #shuffle(*args, **options)
- #shuffle(*args, **options, &)
- #size(*args, **options)
- #size(*args, **options, &)
- #store
- #sum(*args, **options)
- #sum(*args, **options, &)
- #uniq(*args, **options)
- #uniq(*args, **options, &)
- #uniq! : self
Constructor Detail
Instance Method Detail
Returns true
if this struct is equal to other.
Both structs' instance vars are compared to each other. Thus, two structs are considered equal if each of their instance variables are equal. Subclasses should override this method to provide specific equality semantics.
struct Point
def initialize(@x : Int32, @y : Int32)
end
end
p1 = Point.new 1, 2
p2 = Point.new 1, 2
p3 = Point.new 3, 4
p1 == p2 # => true
p1 == p3 # => false
Append. Pushes one value to the end of self
, given that the type of the value is T
(which might be a single type or a union of types).
This method returns self
, so several calls can be chained.
See #pop
for the opposite effect.
a = ["a", "b"]
a.push("c") # => ["a", "b", "c"]
a.push(1) # Errors, because the array only accepts String.
a = ["a", "b"] of (Int32 | String)
a.push("c") # => ["a", "b", "c"]
a.push(1) # => ["a", "b", "c", 1]
Append multiple values. The same as #push
, but takes an arbitrary number
of values to push into self
. Returns self
.
a = ["a"]
a.push("b", "c") # => ["a", "b", "c"]
Modifies self
, deleting the elements in the collection for which the
passed block returns true
. Returns self
.
ary = [1, 6, 2, 4, 8]
ary.reject! { |x| x > 3 }
ary # => [1, 2]
Modifies self
, deleting the elements in the collection for which
pattern === element
.
ary = [1, 6, 2, 4, 8]
ary.reject!(3..7)
ary # => [1, 2, 8]