зеркало из https://github.com/github/ruby.git
[DOC] Tweaks to Array#- (#11303)
This commit is contained in:
Родитель
2a31410ebe
Коммит
3719b3d74d
18
array.c
18
array.c
|
@ -5408,16 +5408,18 @@ ary_make_hash_by(VALUE ary)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* array - other_array -> new_array
|
||||
* self - other_array -> new_array
|
||||
*
|
||||
* Returns a new +Array+ containing only those elements from +array+
|
||||
* that are not found in +Array+ +other_array+;
|
||||
* items are compared using <tt>eql?</tt>;
|
||||
* the order from +array+ is preserved:
|
||||
* Returns a new array containing only those elements of +self+
|
||||
* that are not found in +other_array+;
|
||||
* the order from +self+ is preserved:
|
||||
*
|
||||
* [0, 1, 1, 2, 1, 1, 3, 1, 1] - [1] # => [0, 2, 3]
|
||||
* [0, 1, 2, 3] - [3, 0] # => [1, 2]
|
||||
* [0, 1, 2] - [4] # => [0, 1, 2]
|
||||
* [0, 1, 1, 2, 1, 1, 3, 1, 1] - [1] # => [0, 2, 3]
|
||||
* [0, 1, 1, 2, 1, 1, 3, 1, 1] - [3, 2, 0, :foo] # => [1, 1, 1, 1, 1, 1]
|
||||
* [0, 1, 2] - [:foo] # => [0, 1, 2]
|
||||
*
|
||||
* Element are compared using method <tt>#eql?</tt>
|
||||
* (as defined in each element of +self+).
|
||||
*
|
||||
* Related: Array#difference.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче