1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

array.c: [DOC] add docs for Array#{filter,filter!}

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
stomar 2018-11-04 11:40:32 +00:00
parent bd20f031db
commit 139d9d819c

View file

@ -3139,6 +3139,8 @@ rb_ary_values_at(int argc, VALUE *argv, VALUE ary)
* call-seq:
* ary.select {|item| block} -> new_ary
* ary.select -> Enumerator
* ary.filter {|item| block} -> new_ary
* ary.filter -> Enumerator
*
* Returns a new array containing all elements of +ary+
* for which the given +block+ returns a true value.
@ -3151,6 +3153,8 @@ rb_ary_values_at(int argc, VALUE *argv, VALUE ary)
* a.select {|v| v =~ /[aeiou]/ } #=> ["a", "e"]
*
* See also Enumerable#select.
*
* Array#filter is an alias for Array#select.
*/
static VALUE
@ -3217,6 +3221,8 @@ select_bang_ensure(VALUE a)
* call-seq:
* ary.select! {|item| block } -> ary or nil
* ary.select! -> Enumerator
* ary.filter! {|item| block } -> ary or nil
* ary.filter! -> Enumerator
*
* Invokes the given block passing in successive elements from +self+,
* deleting elements for which the block returns a +false+ value.
@ -3228,6 +3234,8 @@ select_bang_ensure(VALUE a)
* If no block is given, an Enumerator is returned instead.
*
* See also Array#keep_if.
*
* Array#filter! is an alias for Array#select!.
*/
static VALUE