• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/71

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

71 Cards in this Set

  • Front
  • Back
Set Intersection—Returns a new array containing elements common to the two arrays, with no duplicates.
&

usage:
array & other_array
Repetition—With a String argument, equivalent to self.join(str). Otherwise, returns a new array built by concatenating the int copies of self.
*

usage:
array * int → an_array
array * str → a_string
Concatenation—Returns a new array built by concatenating the two arrays together to produce a third array.
+

usage:
array + other_array → an_array
Array Difference—Returns a new array that is a copy of the original array, removing any items that also appear in other_array.
-

usage:
array - other_array → an_array
Append—Pushes the given object on to the end of this array. This expression returns the array itself, so several appends may be chained together.
<<

usage:
array << obj → array
Comparison—Returns an integer (-1, 0, or +1) if this array is less than, equal to, or greater than other_array. Each object in each array is compared (using <=>). If any value isn‘t equal, then that inequality is the return value. If all the values found are equal, then the return is based on a comparison of the array lengths. Thus, two arrays are ``equal’’ according to Array#<=> if and only if they have the same length and the value of each element is equal to the value of the corresponding element in the other array.
<=>

usage:
array <=> other_array → -1, 0, +1
Equality—Two arrays are equal if they contain the same number of elements and if each element is equal to (according to Object.==) the corresponding element in the other array.
==

usage:
array == other_array → bool
Element Reference—Returns the element at index, or returns a subarray starting at start and continuing for length elements, or returns a subarray specified by range. Negative indices count backward from the end of the array (-1 is the last element). Returns nil if the index (or starting index) are out of range.
array[] or slice()

usage:
array[index] → obj or nil
array[start, length] → an_array or nil
array[range] → an_array or nil
array.slice(index) → obj or nil
array.slice(start, length) → an_array or nil
array.slice(range) → an_array or nil
Element Assignment—Sets the element at index, or replaces a subarray starting at start and continuing for length elements, or replaces a subarray specified by range. If indices are greater than the current capacity of the array, the array grows automatically. A negative indices will count backward from the end of the array. Inserts elements if length is zero. If nil is used in the second and third form, deletes elements from self. An IndexError is raised if a negative index points past the beginning of the array. See also Array#push, and Array#unshift.
array[]
Calculates the set of unambiguous abbreviations for the strings in self. If passed a pattern or a string, only the strings matching the pattern or starting with the string are considered.
abbrev

usage:
abbrev(pattern = nil)
Searches through an array whose elements are also arrays comparing obj with the first element of each contained array using obj.==. Returns the first contained array that matches (that is, the first associated array), or nil if no match is found. See also Array#rassoc.
assoc()

usage:
array.assoc(obj) → an_array or nil
Returns the element at index. A negative index counts from the end of self. Returns nil if the index is out of range.
at()

usage:
array.at(index) → obj or nil

See also Array#[]. (Array#at is slightly faster than Array#[], as it does not accept ranges and so on.)
Removes all elements from self.
clear

usage:
array.clear → array
Invokes block once for each element of self. Creates a new array containing the values returned by the block.
collect or map

usage:
array.collect {|item| block } → an_array
array.map {|item| block } → an_array

See also Enumerable#collect.
Invokes the block once for each element of self, replacing the element with the value returned by block.
collect! or map!

usage:
array.collect! {|item| block } → array
array.map! {|item| block } → array
See also Enumerable#collect.
Returns a copy of self with all nil elements removed.
compact

usage:
array.compact → an_array
Removes nil elements from array. Returns nil if no changes were made.
compact!

usage:
array.compact! → array or nil
Appends the elements in other_array to self.
concat()

usage:
array.concat(other_array) → array
Deletes items from self that are equal to obj. If the item is not found, returns nil. If the optional code block is given, returns the result of block if the item is not found.
delete()

usage:
array.delete(obj) → obj or nil
array.delete(obj) { block } → obj or nil
Deletes the element at the specified index, returning that element, or nil if the index is out of range.
delete_at()

usage:
array.delete_at(index) → obj or nil
See also Array#slice!.
Deletes every element of self for which block evaluates to true.
delete_if{}

usage:
array.delete_if {|item| block } → array
Calls block once for each element in self, passing that element as a parameter.
each{}

usage:
array.each {|item| block } → array
Same as Array#each, but passes the index of the element instead of the element itself.
each_index{}

usage:
array.each_index {|index| block } → array
Returns true if self array contains no elements.
empty?

usage:
array.empty? → true or false
Returns true if array and other are the same object, or are both arrays with the same content.
eql?

usage:
array.eql?(other) → true or false
Tries to return the element at position index. If the index lies outside the array, the first form throws an IndexError exception, the second form returns default, and the third form returns the value of invoking the block, passing in the index. Negative values of index count from the end of the array.
fetch()

usage:
array.fetch(index) → obj
array.fetch(index, default ) → obj
array.fetch(index) {|index| block } → obj
The first three forms set the selected elements of self (which may be the entire array) to obj. A start of nil is equivalent to zero. A length of nil is equivalent to self.length. The last three forms fill the array with the value of the block. The block is passed the absolute index of each element to be filled.
fill()

usage:
array.fill(obj) → array
array.fill(obj, start [, length]) → array
array.fill(obj, range ) → array
array.fill {|index| block } → array
array.fill(start [, length] ) {|index| block } → array
array.fill(range) {|index| block } → array
Returns the first element, or the first n elements, of the array. If the array is empty, the first form returns nil, and the second form returns an empty array.
first

usage:
array.first → obj or nil
array.first(n) → an_array
Returns a new array that is a one-dimensional flattening of this array (recursively). That is, for every element that is an array, extract its elements into the new array.
flatten

usage:
array.flatten → an_array
Flattens self in place. Returns nil if no modifications were made (i.e., array contains no subarrays.)
flatten!

usage:
array.flatten! → array or nil
Return true if this array is frozen (or temporarily frozen while being sorted).
frozen?

usage:
array.frozen? → true or false
Compute a hash-code for this array. Two arrays with the same content will have the same hash code (and will compare using eql?).
hash

usage:
array.hash → fixnum
Returns true if the given object is present in self (that is, if any object == anObject), false otherwise.
include?

usage:
array.include?(obj) → true or false
Returns the index of the first object in self such that is == to obj. Returns nil if no match is found.
index

usage:
array.index(obj) → int or nil
Replaces the contents of self with the contents of other_array, truncating or expanding if necessary.
replace

usage:
array.replace(other_array) → array
Inserts the given values before the element with the given index (which may be negative).
insert

usage:
array.insert(index, obj...) → array
Create a printable version of array.
inspect

usage:
array.inspect → string
Returns a string created by converting each element of the array to a string, separated by sep.
join

usage:
array.join(sep=$,) → str
Returns the last element(s) of self. If the array is empty, the first form returns nil.
last

usage:
array.last → obj or nil
array.last(n) → an_array
Returns the number of elements in self. May be zero.
length

usage:
array.length → int
Invokes block once for each element of self. Creates a new array containing the values returned by the block.
collect or map

usage:
array.collect {|item| block } → an_array
array.map {|item| block } → an_array
See also Enumerable#collect.
Invokes the block once for each element of self, replacing the element with the value returned by block.
collect! or map!

usage:
array.collect! {|item| block } → array
array.map! {|item| block } → array
See also Enumerable#collect.
Returns the number of non-nil elements in self. May be zero.
nitems

usage:
array.nitems → int
Packs the contents of arr into a binary sequence according to the directives in aTemplateString (see the table below) Directives ``A,’’ ``a,’’ and ``Z’’ may be followed by a count, which gives the width of the resulting field. The remaining directives also may take a count, indicating the number of array elements to convert. If the count is an asterisk (``*’’), all remaining array elements will be converted. Any of the directives ``sSiIlL’’ may be followed by an underscore (``_’’) to use the underlying platform‘s native size for the specified type; otherwise, they use a platform-independent size. Spaces are ignored in the template string.
pack

usage:
arr.pack ( aTemplateString ) → aBinaryString
See also String#unpack.
Removes the last element from self and returns it, or nil if the array is empty.
pop

usage:
array.pop → obj or nil
Append—Pushes the given object(s) on to the end of this array. This expression returns the array itself, so several appends may be chained together.
push

usage:
array.push(obj, ... ) → array
Searches through the array whose elements are also arrays. Compares key with the second element of each contained array using ==. Returns the first contained array that matches.
rassoc

usage:
array.rassoc(key) → an_array or nil
See also Array#assoc.
Returns a new array containing the items in self for which the block is not true.
reject

usage:
array.reject {|item| block } → an_array
Equivalent to Array#delete_if, deleting elements from self for which the block evaluates to true, but returns nil if no changes were made. Also see Enumerable#reject.
reject!

usage:
array.reject! {|item| block } → array or nil
Replaces the contents of self with the contents of other_array, truncating or expanding if necessary.
replace

usage:
array.replace(other_array) → array
Returns a new array containing self‘s elements in reverse order.
reverse

usage:
array.reverse → an_array
Reverses self in place.
reverse!

usage:
array.reverse! → array
Same as Array#each, but traverses self in reverse order.
reverse_each

usage:
array.reverse_each {|item| block }
Returns the index of the last object in array == to obj. Returns nil if no match is found.
rindex

usage:
array.rindex(obj) → int or nil
Invokes the block passing in successive elements from array, returning an array containing those elements for which the block returns a true value
select

usage:
array.select {|item| block } → an_array
(equivalent to Enumerable#select).
Returns the first element of self and removes it (shifting all other elements down by one). Returns nil if the array is empty.
shift

usage:
array.shift → obj or nil
Alias for length
size()
Element Reference—Returns the element at index, or returns a subarray starting at start and continuing for length elements, or returns a subarray specified by range. Negative indices count backward from the end of the array (-1 is the last element). Returns nil if the index (or starting index) are out of range.
[] or slice

usage:
array[index] → obj or nil
array[start, length] → an_array or nil
array[range] → an_array or nil
array.slice(index) → obj or nil
array.slice(start, length) → an_array or nil
array.slice(range) → an_array or nil
Deletes the element(s) given by an index (optionally with a length) or by a range. Returns the deleted object, subarray, or nil if the index is out of range.
slice!

usage:
array.slice!(index) → obj or nil
array.slice!(start, length) → sub_array or nil
array.slice!(range) → sub_array or nil
Returns a new array created by sorting self. Comparisons for the sort will be done using the <=> operator or using an optional code block. The block implements a comparison between a and b, returning -1, 0, or +1.
array.sort → an_array
array.sort {| a,b | block } → an_array
See also Enumerable#sort_by.
Sorts self. Comparisons for the sort will be done using the <=> operator or using an optional code block. The block implements a comparison between a and b, returning -1, 0, or +1
sort!

usage:
array.sort! → array
array.sort! {| a,b | block } → array
Returns self. If called on a subclass of Array, converts the receiver to an Array object.
to_a

usage:
array.to_a → array
Returns self.
array.to_ary → array
Returns self.join.
to_s

usage:
array.to_s → string
Assumes that self is an array of arrays and transposes the rows and columns.
transpose

usage:
array.transpose → an_array
Returns a new array by removing duplicate values in self.
uniq

usage:
array.uniq → an_array
Removes duplicate elements from self. Returns nil if no changes are made (that is, no duplicates are found).
uniq!

usage:
array.uniq! → array or nil
Prepends objects to the front of array. other elements up one.
unshift

usage:
array.unshift(obj, ...) → array
Returns an array containing the elements in self corresponding to the given selector(s). The selectors may be either integer indices or ranges.
values_at

usage:
array.values_at(selector,... ) → an_array
Converts any arguments to arrays, then merges elements of self with corresponding elements from each argument. This generates a sequence of self.size n-element arrays, where n is one more that the count of arguments. If the size of any argument is less than enumObj.size, nil values are supplied. If a block given, it is invoked for each output array, otherwise an array of arrays is returned.
zip

usage:
array.zip(arg, ...) → an_array
array.zip(arg, ...) {| arr | block } → nil
Set Union—Returns a new array by joining this array with other_array, removing duplicates.
|

usage:
array | other_array → an_array