diff options
author | BurdetteLamar <[email protected]> | 2024-10-08 15:37:49 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-10-08 16:57:19 -0400 |
commit | 0469d169e248dcd2b110dfa5073c9f495fce97d0 (patch) | |
tree | 848bfd2728805335757e3554f966d7ea99fd5e67 /array.c | |
parent | 015d9ebaec8c564e79e2e808d002eb68341a4020 (diff) |
[DOC] Tweaks for Array#reject
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11837
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -4367,21 +4367,19 @@ rb_ary_reject_bang(VALUE ary) /* * call-seq: - * array.reject {|element| ... } -> new_array - * array.reject -> new_enumerator + * reject {|element| ... } -> new_array + * 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+: * * a = [:foo, 'bar', 2, 'bat'] * a1 = a.reject {|element| element.to_s.start_with?('b') } * a1 # => [:foo, 2] * - * Returns a new Enumerator if no block given: - * - * a = [:foo, 'bar', 2] - * a.reject # => #<Enumerator: [:foo, "bar", 2]:reject> + * With no block given, returns a new Enumerator. * + * Related: {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching]. */ static VALUE @@ -8612,6 +8610,7 @@ rb_ary_deconstruct(VALUE ary) * as determined by a given block. * - #sample: Returns one or more random elements. * - #shuffle: Returns elements in a random order. + * - #reject: Returns an array containing elements not rejected by a given block. * * === Methods for Assigning * |