Array

ruby/spec describes 121 methods in core/array, and Metorex implements 121 of them. The parameters are what Method#parameters answers under Metorex.

  • Array#&: implemented, parameters [[:req]]. Returns a new array containing the intersection of self and other_array; that is, containing those elements found in both self and other_array:
  • Array#*: implemented, parameters [[:req]]. When non-negative integer argument n is given, returns a new array built by concatenating n copies of self:
  • Array#+: implemented, parameters [[:req]]. Returns a new array containing all elements of self followed by all elements of other_array:
  • Array#-: implemented, parameters [[:req]]. Returns a new array containing only those elements of self that are not found in other_array; the order from self is preserved:
  • Array#<<: implemented, parameters [[:req]]. Appends object as the last element in self; returns self:
  • Array#<=>: implemented, parameters [[:req]]. Returns -1, 0, or 1 as self is determined to be less than, equal to, or greater than other_array.
  • Array#==: implemented, parameters [[:req]]. Returns whether both:
  • Array#[]: implemented, parameters [[:rest]]. Returns elements from self; does not modify self.
  • Array.[]: implemented, parameters [[:req, :args]]. Returns a new array, populated with the given objects:
  • Array#[]=: implemented, parameters [[:rest]]. Assigns elements in self, based on the given object; returns object.
  • Array#all?: implemented, parameters [[:rest, :pattern]]. Returns whether for every element of self, a given criterion is satisfied. An example calling it.
  • Array.allocate: implemented, parameters [[:req, :args]]. An example calling it.
  • Array#any?: implemented, parameters [[:rest, :pattern]]. Returns whether for any element of self, a given criterion is satisfied. An example calling it.
  • Array#append: implemented, parameters [[:rest]]. Appends each argument in objects to self; returns self: An example calling it.
  • Array#assoc: implemented, parameters [[:req]]. Returns the first element ele in self such that ele is an array and ele[0] == object: An example calling it.
  • Array#at: implemented, parameters [[:req]]. Returns the element of self specified by the given index or nil if there is no such element; index must be an integer-convertible object. An example calling it.
  • Array#bsearch: implemented, parameters []. Returns the element from self found by a binary search, or nil if the search found no suitable element. An example calling it.
  • Array#bsearch_index: implemented, parameters []. Returns the integer index of the element from self found by a binary search, or nil if the search found no suitable element. An example calling it.
  • Array#clear: implemented, parameters []. Removes all elements from self; returns self: An example calling it.
  • Array#clone: implemented, parameters [[:rest, :args]]. Produces a shallow copy of obj---the instance variables of obj are copied, but not the objects they reference. An example calling it.
  • Array#collect: implemented, parameters [[:block, :block]]. With a block given, calls the block with each element of self; returns a new array whose elements are the return values from the block: An example calling it.
  • Array#collect!: implemented, parameters []. With a block given, calls the block with each element of self and replaces the element with the block's return value; returns self:
  • Array#combination: implemented, parameters [[:req, :count]]. When a block and a positive integer-convertible object argument count (0 < count <= self.size) are given, calls the block with each combination of self of size count; returns self: An example calling it.
  • Array#compact: implemented, parameters []. Returns a new array containing only the non-nil elements from self; element order is preserved: An example calling it.
  • Array#compact!: implemented, parameters []. Removes all nil elements from self; Returns self if any elements are removed, nil otherwise: An example calling it.
  • Array#concat: implemented, parameters [[:rest]]. Adds to self all elements from each array in other_arrays; returns self: An example calling it.
  • Array#count: implemented, parameters [[:rest, :wanted]]. Returns a count of specified elements. An example calling it.
  • Array#cycle: implemented, parameters [[:rest, :count]]. With a block given, may call the block, depending on the value of argument count; count must be an integer-convertible object, or nil. An example calling it.
  • Array#deconstruct: implemented, parameters []. An example calling it.
  • Array#delete: implemented, parameters [[:req]]. Removes zero or more elements from self. An example calling it.
  • Array#delete_at: implemented, parameters [[:req]]. Removes the element of self at the given index, which must be an integer-convertible object. An example calling it.
  • Array#delete_if: implemented, parameters []. With a block given, calls the block with each element of self; removes the element if the block returns a truthy value; returns self: An example calling it.
  • Array#detect: implemented, parameters [[:opt, :if_none], [:block, :block]]. Returns the first element for which the block returns a truthy value. An example calling it.
  • Array#difference: implemented, parameters [[:rest]]. Returns a new array containing only those elements from self that are not found in any of the given other_arrays; items are compared using eql?; order from self is preserved: An example calling it.
  • Array#dig: implemented, parameters [[:rest]]. Finds and returns the object in nested object specified by index and identifiers; the nested objects may be instances of various classes. An example calling it.
  • Array#drop: implemented, parameters [[:req, :count]]. Returns a new array containing all but the first count element of self, where count is a non-negative integer; does not modify self. An example calling it.
  • Array#drop_while: implemented, parameters []. With a block given, calls the block with each successive element of self; stops if the block returns false or nil; returns a new array omitting those elements for which the block returned a truthy value; does not modify self: An example calling it.
  • Array#dup: implemented, parameters []. Produces a shallow copy of obj---the instance variables of obj are copied, but not the objects they reference. An example calling it.
  • Array#each: implemented, parameters []. With a block given, iterates over the elements of self, passing each element to the block; returns self: An example calling it.
  • Array#each_index: implemented, parameters []. With a block given, iterates over the elements of self, passing each array index to the block; returns self: An example calling it.
  • Array#empty?: implemented, parameters []. Returns true if the count of elements in self is zero, false otherwise. An example calling it.
  • Array#eql?: implemented, parameters [[:req]]. Returns true if self and other_array are the same size, and if, for each index i in self, self[i].eql?(other_array[i]): An example calling it.
  • Array#fetch: implemented, parameters [[:rest]]. Returns the element of self at offset index if index is in range; index must be an integer-convertible object. An example calling it.
  • Array#fetch_values: implemented, parameters [[:rest, :args]]. With no block given, returns a new array containing the elements of self at the offsets specified by indexes. An example calling it.
  • Array#fill: implemented, parameters [[:rest, :given], [:block, :block]]. Replaces selected elements in self; may add elements to self; always returns self (never a new array). An example calling it.
  • Array#filter: implemented, parameters [[:block, :block]]. With a block given, calls the block with each element of self; returns a new array containing those elements of self for which the block returns a truthy value: An example calling it.
  • Array#filter!: implemented, parameters []. With a block given, calls the block with each element of self; removes from self those elements for which the block returns false or nil.
  • Array#find: implemented, parameters [[:opt, :if_none], [:block, :block]]. Returns the first element for which the block returns a truthy value. An example calling it.
  • Array#find_index: implemented, parameters [[:rest, :wanted]]. Returns the zero-based integer index of a specified element, or nil. An example calling it.
  • Array#first: implemented, parameters [[:rest, :count]]. Returns elements from self, or nil; does not modify self. An example calling it.
  • Array#flatten: implemented, parameters [[:rest]]. Returns a new array that is a recursive flattening of self to depth levels of recursion; depth must be an integer-convertible object or nil. An example calling it.
  • Array#flatten!: implemented, parameters [[:rest]]. Returns self as a recursively flattening of self to depth levels of recursion; depth must be an integer-convertible object, or nil. An example calling it.
  • Array#frozen?: implemented, parameters [[:rest, :args]]. Returns the freeze status of obj. An example calling it.
  • Array#hash: implemented, parameters []. Returns the integer hash value for self. An example calling it.
  • Array#include?: implemented, parameters [[:req, :wanted]]. Returns whether for some element element in self, object == element: An example calling it.
  • Array#index: implemented, parameters [[:rest]]. Returns the zero-based integer index of a specified element, or nil. An example calling it.
  • Array#initialize: implemented, parameters [[:rest]]. An example calling it.
  • Array#insert: implemented, parameters [[:rest]]. Inserts the given objects as elements of self; returns self. An example calling it.
  • Array#inspect: implemented, parameters []. Returns the new string formed by calling method #inspect on each array element: An example calling it.
  • Array#intersect?: implemented, parameters [[:req]]. Returns whether other_array has at least one element that is #eql? to some element of self: An example calling it.
  • Array#intersection: implemented, parameters [[:rest]]. Returns a new array containing each element in self that is #eql? to at least one element in each of the given other_arrays; duplicates are omitted: An example calling it.
  • Array#join: implemented, parameters [[:rest]]. Returns the new string formed by joining the converted elements of self; for each element element: An example calling it.
  • Array#keep_if: implemented, parameters []. With a block given, calls the block with each element of self; removes the element from self if the block does not return a truthy value: An example calling it.
  • Array#last: implemented, parameters [[:rest, :args]]. Returns elements from self, or nil; self is not modified. An example calling it.
  • Array#length: implemented, parameters []. Returns the count of elements in self: An example calling it.
  • Array#map: implemented, parameters [[:block, :block]]. With a block given, calls the block with each element of self; returns a new array whose elements are the return values from the block: An example calling it.
  • Array#map!: implemented, parameters []. With a block given, calls the block with each element of self and replaces the element with the block's return value; returns self: An example calling it.
  • Array#max: implemented, parameters [[:rest]]. Returns one of the following: An example calling it.
  • Array#min: implemented, parameters [[:rest]]. Returns one of the following: An example calling it.
  • Array#minmax: implemented, parameters []. Returns a 2-element array containing the minimum-valued and maximum-valued elements from self; does not modify self. An example calling it.
  • Array.new: implemented, parameters [[:rest]]. Returns a new array. An example calling it.
  • Array#none?: implemented, parameters [[:rest, :pattern]]. Returns true if no element of self meets a given criterion, false otherwise. An example calling it.
  • Array#one?: implemented, parameters [[:rest, :pattern]]. Returns true if exactly one element of self meets a given criterion. An example calling it.
  • Array#pack: implemented, parameters [[:rest, :args]]. Formats each element in self into a binary string; returns that string. An example calling it.
  • Array#partition: implemented, parameters []. With a block given, returns an array of two arrays: An example calling it.
  • Array#permutation: implemented, parameters [[:opt, :count]]. Iterates over permutations of the elements of self; the order of permutations is indeterminate. An example calling it.
  • Array#pop: implemented, parameters [[:rest]]. Removes and returns trailing elements of self. An example calling it.
  • Array#prepend: implemented, parameters [[:rest]]. Prepends the given objects to self: An example calling it.
  • Array#product: implemented, parameters [[:rest, :lists]]. Computes all combinations of elements from all the arrays, including both self and other_arrays: An example calling it.
  • Array#push: implemented, parameters [[:rest]]. Appends each argument in objects to self; returns self: An example calling it.
  • Array#rassoc: implemented, parameters [[:req]]. Returns the first element ele in self such that ele is an array and ele[1] == object: An example calling it.
  • Array#reject: implemented, parameters []. With a block given, returns a new array whose elements are all those from self for which the block returns false or nil: An example calling it.
  • Array#reject!: implemented, parameters []. With a block given, calls the block with each element of self; removes each element for which the block returns a truthy value. An example calling it.
  • Array#repeated_combination: implemented, parameters [[:req, :count]]. With a block given, calls the block with each repeated combination of length size of the elements of self; each combination is an array; returns self. An example calling it.
  • Array#repeated_permutation: implemented, parameters [[:req, :count]]. With a block given, calls the block with each repeated permutation of length size of the elements of self; each permutation is an array; returns self. An example calling it.
  • Array#replace: implemented, parameters [[:req]]. Replaces the elements of self with the elements of other_array, which must be an array-convertible object; returns self: An example calling it.
  • Array#reverse: implemented, parameters []. Returns a new array containing the elements of self in reverse order: An example calling it.
  • Array#reverse!: implemented, parameters []. Reverses the order of the elements of self; returns self: An example calling it.
  • Array#reverse_each: implemented, parameters [[:block, :block]]. When a block given, iterates backwards over the elements of self, passing, in reverse order, each element to the block; returns self: An example calling it.
  • Array#rfind: implemented, parameters [[:opt, :if_none]]. Returns the last element for which the block returns a truthy value. An example calling it.
  • Array#rindex: implemented, parameters [[:rest]]. Returns the index of the last element for which object == element. An example calling it.
  • Array#rotate: implemented, parameters [[:rest]]. Returns a new array formed from self with elements rotated from one end to the other. An example calling it.
  • Array#rotate!: implemented, parameters [[:rest]]. Rotates self in place by moving elements from one end to the other; returns self.
  • Array#sample: implemented, parameters [[:rest, :args]]. Returns random elements from self, as selected by the object given by the keyword argument random. An example calling it.
  • Array#select: implemented, parameters []. With a block given, calls the block with each element of self; returns a new array containing those elements of self for which the block returns a truthy value: An example calling it.
  • Array#select!: implemented, parameters []. With a block given, calls the block with each element of self; removes from self those elements for which the block returns false or nil. An example calling it.
  • Array#shift: implemented, parameters [[:rest]]. Removes and returns leading elements from self. An example calling it.
  • Array#shuffle: implemented, parameters [[:rest, :args]]. Returns a new array containing all elements from self in a random order, as selected by the object given by the keyword argument random: An example calling it.
  • Array#shuffle!: implemented, parameters [[:rest, :args]]. Shuffles all elements in self into a random order, as selected by the object given by the keyword argument random.
  • Array#size: implemented, parameters []. Returns the count of elements in self: An example calling it.
  • Array#slice: implemented, parameters [[:rest]]. Returns elements from self; does not modify self. An example calling it.
  • Array#slice!: implemented, parameters [[:rest]]. Removes and returns elements from self. An example calling it.
  • Array#sort: implemented, parameters [[:block, :block]]. Returns a new array containing the elements of self, sorted. An example calling it.
  • Array#sort!: implemented, parameters []. Like Array#sort, but returns self with its elements sorted in place. An example calling it.
  • Array#sort_by!: implemented, parameters []. With a block given, sorts the elements of self in place; returns self. An example calling it.
  • Array#sum: implemented, parameters [[:rest, :start]]. With no block given, returns the sum of init and all elements of self; for array array and value init, equivalent to: An example calling it.
  • Array#take: implemented, parameters [[:req, :count]]. Returns a new array containing the first count element of self (as available); count must be a non-negative numeric; does not modify self: An example calling it.
  • Array#take_while: implemented, parameters []. With a block given, calls the block with each successive element of self; stops iterating if the block returns false or nil; returns a new array containing those elements for which the block returned a truthy value: An example calling it.
  • Array#to_a: implemented, parameters [[:rest, :args]]. When self is an instance of Array, returns self. An example calling it.
  • Array#to_ary: implemented, parameters []. Returns self. An example calling it.
  • Array#to_h: implemented, parameters [[:block, :block]]. Returns a new hash formed from self. An example calling it.
  • Array#to_s: implemented, parameters []. Returns the new string formed by calling method #inspect on each array element: An example calling it.
  • Array#transpose: implemented, parameters []. Returns a new array that is self as a transposed matrix: An example calling it.
  • Array.try_convert: implemented, parameters [[:req, :held]]. Attempts to return an array, based on the given object. An example calling it.
  • Array#union: implemented, parameters [[:rest]]. Returns a new array that is the union of the elements of self and all given arrays other_arrays; items are compared using eql?: An example calling it.
  • Array#uniq: implemented, parameters [[:block, :block]]. Returns a new array containing those elements from self that are not duplicates, the first occurrence always being retained. An example calling it.
  • Array#uniq!: implemented, parameters []. Removes duplicate elements from self, the first occurrence always being retained; returns self if any elements removed, nil otherwise. An example calling it.
  • Array#unshift: implemented, parameters [[:rest]]. Prepends the given objects to self: An example calling it.
  • Array#values_at: implemented, parameters [[:rest]]. Returns elements from self in a new array; does not modify self. An example calling it.
  • Array#zip: implemented, parameters [[:rest, :others]]. With no block given, combines self with the collection of other_arrays; returns a new array of sub-arrays: An example calling it.
  • Array#|: implemented, parameters [[:req]]. Returns the union of self and other_array; duplicates are removed; order is preserved; items are compared using eql?:

The method summaries are the first sentences of Ruby's own documentation for each method, read from MRI 4.0.6's ri data. Ruby's documentation is distributed under Ruby's license.