struct

Wraith::ArrayStore(T)

Inherits Atomically / Struct / Value / Object

Constructors

Instance methods

<<(elem : T) : self
Source
==(other_array) : Bool

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
Source
[](*args, **options)
Source
[](*args, **options, &)
Source
[]=(index : Int, value : T)
Source
[]=(range : Range, value : T)
Source
all?(*args, **options)
Source
all?(*args, **options, &)
Source
any?(*args, **options)
Source
any?(*args, **options, &)
Source
assign(new_array : Array(T))
Source
compact(*args, **options)
Source
compact(*args, **options, &)
Source
compact!
Source
count(*args, **options)
Source
count(*args, **options, &)
Source
delete(obj) : T | Nil
Source
delete_at(index : Int) : self
Source
each(*args, **options)
Source
each(*args, **options, &)
Source
each_with_index(*args, **options)
Source
each_with_index(*args, **options, &)
Source
first(*args, **options)
Source
first(*args, **options, &)
Source
index(*args, **options)
Source
index(*args, **options, &)
Source
join(*args, **options)
Source
join(*args, **options, &)
Source
last(*args, **options)
Source
last(*args, **options, &)
Source
map(*args, **options)
Source
map(*args, **options, &)
Source
max(*args, **options)
Source
max(*args, **options, &)
Source
min(*args, **options)
Source
min(*args, **options, &)
Source
minmax(*args, **options)
Source
minmax(*args, **options, &)
Source
push(value : T)

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]
Source
push(*values : T) : self

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"]
Source
reject(*args, **options)
Source
reject(*args, **options, &)
Source
reject!

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]
Source
reject!(pattern) : self

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]
Source
reverse(*args, **options)
Source
reverse(*args, **options, &)
Source
reverse!
Source
sample(*args, **options)
Source
sample(*args, **options, &)
Source
select(*args, **options)
Source
select(*args, **options, &)
Source
shift
Source
shuffle(*args, **options)
Source
shuffle(*args, **options, &)
Source
size(*args, **options)
Source
size(*args, **options, &)
Source
store
Source
sum(*args, **options)
Source
sum(*args, **options, &)
Source
uniq(*args, **options)
Source
uniq(*args, **options, &)
Source
uniq!
Source