[DOC] Tweaks for Array#reject
This commit is contained in:
parent
015d9ebaec
commit
0469d169e2
Notes:
git
2024-10-08 20:57:36 +00:00
13
array.c
13
array.c
@ -4367,21 +4367,19 @@ rb_ary_reject_bang(VALUE ary)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.reject {|element| ... } -> new_array
|
* reject {|element| ... } -> new_array
|
||||||
* array.reject -> new_enumerator
|
* reject -> new_enumerator
|
||||||
*
|
*
|
||||||
* Returns a new +Array+ whose elements are all those from +self+
|
* With a block given, returns a new array whose elements are all those from +self+
|
||||||
* for which the block returns +false+ or +nil+:
|
* for which the block returns +false+ or +nil+:
|
||||||
*
|
*
|
||||||
* a = [:foo, 'bar', 2, 'bat']
|
* a = [:foo, 'bar', 2, 'bat']
|
||||||
* a1 = a.reject {|element| element.to_s.start_with?('b') }
|
* a1 = a.reject {|element| element.to_s.start_with?('b') }
|
||||||
* a1 # => [:foo, 2]
|
* a1 # => [:foo, 2]
|
||||||
*
|
*
|
||||||
* Returns a new Enumerator if no block given:
|
* With no block given, returns a new Enumerator.
|
||||||
*
|
|
||||||
* a = [:foo, 'bar', 2]
|
|
||||||
* a.reject # => #<Enumerator: [:foo, "bar", 2]:reject>
|
|
||||||
*
|
*
|
||||||
|
* Related: {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -8612,6 +8610,7 @@ rb_ary_deconstruct(VALUE ary)
|
|||||||
* as determined by a given block.
|
* as determined by a given block.
|
||||||
* - #sample: Returns one or more random elements.
|
* - #sample: Returns one or more random elements.
|
||||||
* - #shuffle: Returns elements in a random order.
|
* - #shuffle: Returns elements in a random order.
|
||||||
|
* - #reject: Returns an array containing elements not rejected by a given block.
|
||||||
*
|
*
|
||||||
* === Methods for Assigning
|
* === Methods for Assigning
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user