Wraith::ArrayStore(T)
Inherits Atomically / Struct / Value / Object
Constructors
Instance methods
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]