[DOC] Tweaks to Array#compact!

This commit is contained in:
BurdetteLamar 2024-08-24 15:57:47 +01:00 коммит произвёл Peter Zhu
Родитель 418e85b120
Коммит e962c9c4c3
1 изменённых файлов: 9 добавлений и 3 удалений

12
array.c
Просмотреть файл

@ -6285,11 +6285,17 @@ rb_ary_uniq(VALUE ary)
/*
* call-seq:
* array.compact! -> self or nil
* compact! -> self or nil
*
* Removes all +nil+ elements from +self+.
* Removes all +nil+ elements from +self+;
* Returns +self+ if any elements are removed, +nil+ otherwise:
*
* Returns +self+ if any elements removed, otherwise +nil+.
* a = [nil, 0, nil, false, nil, '', nil, [], nil, {}]
* a.compact! # => [0, false, "", [], {}]
* a # => [0, false, "", [], {}]
* a.compact! # => nil
*
* Related: Array#compact.
*/
static VALUE