* array.c: rdoc patch - unified margin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
038ed182dd
commit
b956b4a450
@ -1,3 +1,7 @@
|
|||||||
|
Wed Jul 14 01:20:21 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
|
* array.c: rdoc patch - unified margin.
|
||||||
|
|
||||||
Wed Jul 14 00:33:48 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
Wed Jul 14 00:33:48 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
* array.c: rdoc patch. merged patch from Johan Holmberg
|
* array.c: rdoc patch. merged patch from Johan Holmberg
|
||||||
|
329
array.c
329
array.c
@ -81,11 +81,11 @@ rb_ary_freeze(ary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.frozen? -> true or false
|
* array.frozen? -> true or false
|
||||||
*
|
*
|
||||||
* Return <code>true</code> if this array is frozen (or temporarily frozen
|
* Return <code>true</code> if this array is frozen (or temporarily frozen
|
||||||
* while being sorted).
|
* while being sorted).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -312,41 +312,41 @@ rb_check_array_type(ary)
|
|||||||
static VALUE rb_ary_replace _((VALUE, VALUE));
|
static VALUE rb_ary_replace _((VALUE, VALUE));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* Array.new(size=0, obj=nil)
|
* Array.new(size=0, obj=nil)
|
||||||
* Array.new(array)
|
* Array.new(array)
|
||||||
* Array.new(size) {|index| block }
|
* Array.new(size) {|index| block }
|
||||||
|
|
||||||
* Returns a new array. In the first form, the new array is
|
|
||||||
* empty. In the second it is created with _size_ copies of _obj_
|
|
||||||
* (that is, _size_ references to the same
|
|
||||||
* _obj_). The third form creates a copy of the array
|
|
||||||
* passed as a parameter (the array is generated by calling
|
|
||||||
* to_ary on the parameter). In the last form, an array
|
|
||||||
* of the given size is created. Each element in this array is
|
|
||||||
* calculated by passing the element's index to the given block and
|
|
||||||
* storing the return value.
|
|
||||||
*
|
*
|
||||||
* Array.new
|
* Returns a new array. In the first form, the new array is
|
||||||
* Array.new(2)
|
* empty. In the second it is created with _size_ copies of _obj_
|
||||||
* Array.new(5, "A")
|
* (that is, _size_ references to the same
|
||||||
|
* _obj_). The third form creates a copy of the array
|
||||||
|
* passed as a parameter (the array is generated by calling
|
||||||
|
* to_ary on the parameter). In the last form, an array
|
||||||
|
* of the given size is created. Each element in this array is
|
||||||
|
* calculated by passing the element's index to the given block and
|
||||||
|
* storing the return value.
|
||||||
*
|
*
|
||||||
* # only one copy of the object is created
|
* Array.new
|
||||||
* a = Array.new(2, Hash.new)
|
* Array.new(2)
|
||||||
* a[0]['cat'] = 'feline'
|
* Array.new(5, "A")
|
||||||
* a
|
|
||||||
* a[1]['cat'] = 'Felix'
|
|
||||||
* a
|
|
||||||
*
|
*
|
||||||
* # here multiple copies are created
|
* # only one copy of the object is created
|
||||||
* a = Array.new(2) { Hash.new }
|
* a = Array.new(2, Hash.new)
|
||||||
* a[0]['cat'] = 'feline'
|
* a[0]['cat'] = 'feline'
|
||||||
* a
|
* a
|
||||||
|
* a[1]['cat'] = 'Felix'
|
||||||
|
* a
|
||||||
*
|
*
|
||||||
* squares = Array.new(5) {|i| i*i}
|
* # here multiple copies are created
|
||||||
* squares
|
* a = Array.new(2) { Hash.new }
|
||||||
|
* a[0]['cat'] = 'feline'
|
||||||
|
* a
|
||||||
*
|
*
|
||||||
* copy = Array.new(squares)
|
* squares = Array.new(5) {|i| i*i}
|
||||||
|
* squares
|
||||||
|
*
|
||||||
|
* copy = Array.new(squares)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -508,12 +508,12 @@ ary_shared_last(argc, argv, ary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array << obj -> array
|
* array << obj -> array
|
||||||
*
|
*
|
||||||
* Append---Pushes the given object on to the end of this array. This
|
* Append---Pushes the given object on to the end of this array. This
|
||||||
* expression returns the array itself, so several appends
|
* expression returns the array itself, so several appends
|
||||||
* may be chained together.
|
* may be chained together.
|
||||||
*
|
*
|
||||||
* [ 1, 2 ] << "c" << "d" << [ 3, 4 ]
|
* [ 1, 2 ] << "c" << "d" << [ 3, 4 ]
|
||||||
* #=> [ 1, 2, "c", "d", [ 3, 4 ] ]
|
* #=> [ 1, 2, "c", "d", [ 3, 4 ] ]
|
||||||
@ -530,12 +530,12 @@ rb_ary_push(ary, item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.push(obj, ... ) -> array
|
* array.push(obj, ... ) -> array
|
||||||
*
|
*
|
||||||
* Append---Pushes the given object(s) on to the end of this array. This
|
* Append---Pushes the given object(s) on to the end of this array. This
|
||||||
* expression returns the array itself, so several appends
|
* expression returns the array itself, so several appends
|
||||||
* may be chained together.
|
* may be chained together.
|
||||||
*
|
*
|
||||||
* a = [ "a", "b", "c" ]
|
* a = [ "a", "b", "c" ]
|
||||||
* a.push("d", "e", "f")
|
* a.push("d", "e", "f")
|
||||||
@ -761,23 +761,23 @@ rb_ary_subseq(ary, beg, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array[index] -> obj or nil
|
* array[index] -> obj or nil
|
||||||
* array[start, length] -> an_array or nil
|
* array[start, length] -> an_array or nil
|
||||||
* array[range] -> an_array or nil
|
* array[range] -> an_array or nil
|
||||||
* array.slice(index) -> obj or nil
|
* array.slice(index) -> obj or nil
|
||||||
* array.slice(start, length) -> an_array or nil
|
* array.slice(start, length) -> an_array or nil
|
||||||
* array.slice(range) -> an_array or nil
|
* array.slice(range) -> an_array or nil
|
||||||
*
|
*
|
||||||
* Element Reference---Returns the element at _index_,
|
* Element Reference---Returns the element at _index_,
|
||||||
* or returns a subarray starting at _start_ and
|
* or returns a subarray starting at _start_ and
|
||||||
* continuing for _length_ elements, or returns a subarray
|
* continuing for _length_ elements, or returns a subarray
|
||||||
* specified by _range_.
|
* specified by _range_.
|
||||||
* Negative indices count backward from the end of the
|
* Negative indices count backward from the end of the
|
||||||
* array (-1 is the last element). Returns nil if any indices
|
* array (-1 is the last element). Returns nil if any indices
|
||||||
* are out of range unless the index equals the array size and a
|
* are out of range unless the index equals the array size and a
|
||||||
* _length_ or _range_ parameter is given, in which case an
|
* _length_ or _range_ parameter is given, in which case an
|
||||||
* empty array is returned.
|
* empty array is returned.
|
||||||
*
|
*
|
||||||
* a = [ "a", "b", "c", "d", "e" ]
|
* a = [ "a", "b", "c", "d", "e" ]
|
||||||
* a[2] + a[0] + a[1] #=> "cab"
|
* a[2] + a[0] + a[1] #=> "cab"
|
||||||
@ -838,14 +838,14 @@ rb_ary_aref(argc, argv, ary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.at(index) -> obj or nil
|
* array.at(index) -> obj or nil
|
||||||
*
|
*
|
||||||
* Returns the element at _index_. A
|
* Returns the element at _index_. A
|
||||||
* negative index counts from the end of _self_. Returns +nil+
|
* negative index counts from the end of _self_. Returns +nil+
|
||||||
* if the index is out of range. See also <code>Array#[]</code>.
|
* if the index is out of range. See also <code>Array#[]</code>.
|
||||||
* (<code>Array#at</code> is slightly faster than <code>Array#[]</code>,
|
* (<code>Array#at</code> is slightly faster than <code>Array#[]</code>,
|
||||||
* as it does not accept ranges and so on.)
|
* as it does not accept ranges and so on.)
|
||||||
*
|
*
|
||||||
* a = [ "a", "b", "c", "d", "e" ]
|
* a = [ "a", "b", "c", "d", "e" ]
|
||||||
* a.at(0) #=> "a"
|
* a.at(0) #=> "a"
|
||||||
@ -1098,22 +1098,22 @@ rb_ary_update(ary, beg, len, rpl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array[index] = obj -> obj
|
* array[index] = obj -> obj
|
||||||
* array[start, length] = obj or an_array or nil -> obj or an_array or nil
|
* array[start, length] = obj or an_array or nil -> obj or an_array or nil
|
||||||
* array[range] = obj or an_array or nil -> obj or an_array or nil
|
* array[range] = obj or an_array or nil -> obj or an_array or nil
|
||||||
*
|
*
|
||||||
* Element Assignment---Sets the element at _index_,
|
* Element Assignment---Sets the element at _index_,
|
||||||
* or replaces a subarray starting at _start_ and
|
* or replaces a subarray starting at _start_ and
|
||||||
* continuing for _length_ elements, or replaces a subarray
|
* continuing for _length_ elements, or replaces a subarray
|
||||||
* specified by _range_. If indices are greater than
|
* specified by _range_. If indices are greater than
|
||||||
* the current capacity of the array, the array grows
|
* the current capacity of the array, the array grows
|
||||||
* automatically. A negative indices will count backward
|
* automatically. A negative indices will count backward
|
||||||
* from the end of the array. Inserts elements if _length_ is
|
* from the end of the array. Inserts elements if _length_ is
|
||||||
* zero. If +nil+ is used in the second and third form,
|
* zero. If +nil+ is used in the second and third form,
|
||||||
* deletes elements from _self_. An +IndexError+ is raised if a
|
* deletes elements from _self_. An +IndexError+ is raised if a
|
||||||
* negative index points past the beginning of the array. See also
|
* negative index points past the beginning of the array. See also
|
||||||
* <code>Array#push</code>, and <code>Array#unshift</code>.
|
* <code>Array#push</code>, and <code>Array#unshift</code>.
|
||||||
*
|
*
|
||||||
* a = Array.new
|
* a = Array.new
|
||||||
* a[4] = "4"; #=> [nil, nil, nil, nil, "4"]
|
* a[4] = "4"; #=> [nil, nil, nil, nil, "4"]
|
||||||
@ -1538,10 +1538,10 @@ inspect_ary(ary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.inspect -> string
|
* array.inspect -> string
|
||||||
*
|
*
|
||||||
* Create a printable version of <i>array</i>.
|
* Create a printable version of <i>array</i>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -1774,13 +1774,13 @@ rb_ary_collect(ary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.collect! {|item| block } -> array
|
* array.collect! {|item| block } -> array
|
||||||
* array.map! {|item| block } -> array
|
* array.map! {|item| block } -> array
|
||||||
*
|
*
|
||||||
* Invokes the block once for each element of _self_, replacing the
|
* Invokes the block once for each element of _self_, replacing the
|
||||||
* element with the value returned by _block_.
|
* element with the value returned by _block_.
|
||||||
* See also <code>Enumerable#collect</code>.
|
* See also <code>Enumerable#collect</code>.
|
||||||
*
|
*
|
||||||
* a = [ "a", "b", "c", "d" ]
|
* a = [ "a", "b", "c", "d" ]
|
||||||
* a.collect! {|x| x + "!" }
|
* a.collect! {|x| x + "!" }
|
||||||
@ -1834,19 +1834,19 @@ rb_get_values_at(obj, olen, argc, argv, func)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.values_at(selector,... ) -> an_array
|
* array.values_at(selector,... ) -> an_array
|
||||||
*
|
*
|
||||||
* Returns an array containing the elements in
|
* Returns an array containing the elements in
|
||||||
* _self_ corresponding to the given selector(s). The selectors
|
* _self_ corresponding to the given selector(s). The selectors
|
||||||
* may be either integer indices or ranges.
|
* may be either integer indices or ranges.
|
||||||
* See also <code>Array#select</code>.
|
* See also <code>Array#select</code>.
|
||||||
*
|
*
|
||||||
* a = %w{ a b c d e f }
|
* a = %w{ a b c d e f }
|
||||||
* a.values_at(1, 3, 5)
|
* a.values_at(1, 3, 5)
|
||||||
* a.values_at(1, 3, 5, 7)
|
* a.values_at(1, 3, 5, 7)
|
||||||
* a.values_at(-1, -3, -5, -7)
|
* a.values_at(-1, -3, -5, -7)
|
||||||
* a.values_at(1..3, 2...5)
|
* a.values_at(1..3, 2...5)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -2350,11 +2350,11 @@ rb_ary_fill(argc, argv, ary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array + other_array -> an_array
|
* array + other_array -> an_array
|
||||||
*
|
*
|
||||||
* Concatenation---Returns a new array built by concatenating the
|
* Concatenation---Returns a new array built by concatenating the
|
||||||
* two arrays together to produce a third array.
|
* two arrays together to produce a third array.
|
||||||
*
|
*
|
||||||
* [ 1, 2, 3 ] + [ 4, 5 ] #=> [ 1, 2, 3, 4, 5 ]
|
* [ 1, 2, 3 ] + [ 4, 5 ] #=> [ 1, 2, 3, 4, 5 ]
|
||||||
*/
|
*/
|
||||||
@ -2376,8 +2376,8 @@ rb_ary_plus(x, y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.concat(other_array) -> array
|
* array.concat(other_array) -> array
|
||||||
*
|
*
|
||||||
* Appends the elements in other_array to _self_.
|
* Appends the elements in other_array to _self_.
|
||||||
*
|
*
|
||||||
@ -2398,13 +2398,13 @@ rb_ary_concat(x, y)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array * int -> an_array
|
* array * int -> an_array
|
||||||
* array * str -> a_string
|
* array * str -> a_string
|
||||||
*
|
*
|
||||||
* Repetition---With a String argument, equivalent to
|
* Repetition---With a String argument, equivalent to
|
||||||
* self.join(str). Otherwise, returns a new array
|
* self.join(str). Otherwise, returns a new array
|
||||||
* built by concatenating the _int_ copies of _self_.
|
* built by concatenating the _int_ copies of _self_.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* [ 1, 2, 3 ] * 3 #=> [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ]
|
* [ 1, 2, 3 ] * 3 #=> [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ]
|
||||||
@ -2446,16 +2446,16 @@ rb_ary_times(ary, times)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.assoc(obj) -> an_array or nil
|
* array.assoc(obj) -> an_array or nil
|
||||||
*
|
*
|
||||||
* Searches through an array whose elements are also arrays
|
* Searches through an array whose elements are also arrays
|
||||||
* comparing _obj_ with the first element of each contained array
|
* comparing _obj_ with the first element of each contained array
|
||||||
* using obj.==.
|
* using obj.==.
|
||||||
* Returns the first contained array that matches (that
|
* Returns the first contained array that matches (that
|
||||||
* is, the first associated array),
|
* is, the first associated array),
|
||||||
* or +nil+ if no match is found.
|
* or +nil+ if no match is found.
|
||||||
* See also <code>Array#rassoc</code>.
|
* See also <code>Array#rassoc</code>.
|
||||||
*
|
*
|
||||||
* s1 = [ "colors", "red", "blue", "green" ]
|
* s1 = [ "colors", "red", "blue", "green" ]
|
||||||
* s2 = [ "letters", "a", "b", "c" ]
|
* s2 = [ "letters", "a", "b", "c" ]
|
||||||
@ -2518,12 +2518,12 @@ rb_ary_rassoc(ary, value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array == other_array -> bool
|
* array == other_array -> bool
|
||||||
*
|
*
|
||||||
* Equality---Two arrays are equal if they contain the same number
|
* Equality---Two arrays are equal if they contain the same number
|
||||||
* of elements and if each element is equal to (according to
|
* of elements and if each element is equal to (according to
|
||||||
* Object.==) the corresponding element in the other array.
|
* Object.==) the corresponding element in the other array.
|
||||||
*
|
*
|
||||||
* [ "a", "c" ] == [ "a", "c", 7 ] #=> false
|
* [ "a", "c" ] == [ "a", "c", 7 ] #=> false
|
||||||
* [ "a", "c", 7 ] == [ "a", "c", 7 ] #=> true
|
* [ "a", "c", 7 ] == [ "a", "c", 7 ] #=> true
|
||||||
@ -2553,11 +2553,11 @@ rb_ary_equal(ary1, ary2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.eql?(other) -> true or false
|
* array.eql?(other) -> true or false
|
||||||
*
|
*
|
||||||
* Returns <code>true</code> if _array_ and _other_ are the same object,
|
* Returns <code>true</code> if _array_ and _other_ are the same object,
|
||||||
* or are both arrays with the same content.
|
* or are both arrays with the same content.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -2577,11 +2577,11 @@ rb_ary_eql(ary1, ary2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.hash -> fixnum
|
* array.hash -> fixnum
|
||||||
*
|
*
|
||||||
* Compute a hash-code for this array. Two arrays with the same content
|
* Compute a hash-code for this array. Two arrays with the same content
|
||||||
* will have the same hash code (and will compare using <code>eql?</code>).
|
* will have the same hash code (and will compare using <code>eql?</code>).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -2630,19 +2630,19 @@ rb_ary_includes(ary, item)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array <=> other_array -> -1, 0, +1
|
* array <=> other_array -> -1, 0, +1
|
||||||
*
|
*
|
||||||
* Comparison---Returns an integer (-1, 0,
|
* Comparison---Returns an integer (-1, 0,
|
||||||
* or +1) if this array is less than, equal to, or greater than
|
* or +1) if this array is less than, equal to, or greater than
|
||||||
* other_array. Each object in each array is compared
|
* other_array. Each object in each array is compared
|
||||||
* (using <=>). If any value isn't
|
* (using <=>). If any value isn't
|
||||||
* equal, then that inequality is the return value. If all the
|
* equal, then that inequality is the return value. If all the
|
||||||
* values found are equal, then the return is based on a
|
* values found are equal, then the return is based on a
|
||||||
* comparison of the array lengths. Thus, two arrays are
|
* comparison of the array lengths. Thus, two arrays are
|
||||||
* ``equal'' according to <code>Array#<=></code> if and only if they have
|
* ``equal'' according to <code>Array#<=></code> if and only if they have
|
||||||
* the same length and the value of each element is equal to the
|
* the same length and the value of each element is equal to the
|
||||||
* value of the corresponding element in the other array.
|
* value of the corresponding element in the other array.
|
||||||
*
|
*
|
||||||
* [ "a", "a", "c" ] <=> [ "a", "b", "c" ] #=> -1
|
* [ "a", "a", "c" ] <=> [ "a", "b", "c" ] #=> -1
|
||||||
* [ 1, 2, 3, 4, 5, 6 ] <=> [ 1, 2 ] #=> +1
|
* [ 1, 2, 3, 4, 5, 6 ] <=> [ 1, 2 ] #=> +1
|
||||||
@ -2691,13 +2691,13 @@ ary_make_hash(ary1, ary2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array - other_array -> an_array
|
* array - other_array -> an_array
|
||||||
*
|
*
|
||||||
* Array Difference---Returns a new array that is a copy of
|
* Array Difference---Returns a new array that is a copy of
|
||||||
* the original array, removing any items that also appear in
|
* the original array, removing any items that also appear in
|
||||||
* other_array. (If you need set-like behavior, see the
|
* other_array. (If you need set-like behavior, see the
|
||||||
* library class Set.)
|
* library class Set.)
|
||||||
*
|
*
|
||||||
* [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ]
|
* [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ]
|
||||||
*/
|
*/
|
||||||
@ -2720,13 +2720,13 @@ rb_ary_diff(ary1, ary2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array & other_array
|
* array & other_array
|
||||||
*
|
*
|
||||||
* Set Intersection---Returns a new array
|
* Set Intersection---Returns a new array
|
||||||
* containing elements common to the two arrays, with no duplicates.
|
* containing elements common to the two arrays, with no duplicates.
|
||||||
*
|
*
|
||||||
* [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ]
|
* [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -2753,13 +2753,13 @@ rb_ary_and(ary1, ary2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array | other_array -> an_array
|
* array | other_array -> an_array
|
||||||
*
|
*
|
||||||
* Set Union---Returns a new array by joining this array with
|
* Set Union---Returns a new array by joining this array with
|
||||||
* other_array, removing duplicates.
|
* other_array, removing duplicates.
|
||||||
*
|
*
|
||||||
* [ "a", "b", "c" ] | [ "c", "d", "a" ]
|
* [ "a", "b", "c" ] | [ "c", "d", "a" ]
|
||||||
* #=> [ "a", "b", "c", "d" ]
|
* #=> [ "a", "b", "c", "d" ]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -2852,11 +2852,12 @@ rb_ary_uniq(ary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.compact! -> array or nil
|
* array.compact! -> array or nil
|
||||||
*
|
*
|
||||||
* Removes +nil+ elements from array.
|
* Removes +nil+ elements from array.
|
||||||
* Returns +nil+ if no changes were made.
|
* Returns +nil+ if no changes were made.
|
||||||
|
*
|
||||||
* [ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ]
|
* [ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ]
|
||||||
* [ "a", "b", "c" ].compact! #=> nil
|
* [ "a", "b", "c" ].compact! #=> nil
|
||||||
*/
|
*/
|
||||||
@ -2885,12 +2886,12 @@ rb_ary_compact_bang(ary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.compact -> an_array
|
* array.compact -> an_array
|
||||||
*
|
*
|
||||||
* Returns a copy of _self_ with all +nil+ elements removed.
|
* Returns a copy of _self_ with all +nil+ elements removed.
|
||||||
*
|
*
|
||||||
* [ "a", nil, "b", nil, "c", nil ].compact
|
* [ "a", nil, "b", nil, "c", nil ].compact
|
||||||
* #=> [ "a", "b", "c" ]
|
* #=> [ "a", "b", "c" ]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user