diff options
author | BurdetteLamar <[email protected]> | 2024-09-16 07:21:21 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-09-16 12:33:07 -0400 |
commit | 4e17fa2906c51d6f5e70023c7b300b61ae378b13 (patch) | |
tree | 7ed26e7a81d134edc403fc7315b8b6337c6eaee4 /array.c | |
parent | 1e52dde82af10f2a2ec648b34dce30bec4154245 (diff) |
Tweaks or Array#select
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11629
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -3853,22 +3853,22 @@ rb_ary_values_at(int argc, VALUE *argv, VALUE ary) /* * call-seq: - * array.select {|element| ... } -> new_array - * array.select -> new_enumerator + * select {|element| ... } -> new_array + * select -> new_enumerator + * filter {|element| ... } -> new_array + * filter -> new_enumerator * - * Calls the block, if given, with each element of +self+; - * returns a new +Array+ containing those elements of +self+ + * With a block given, calls the block with each element of +self+; + * returns a new array containing those elements of +self+ * for which the block returns a truthy value: * * a = [:foo, 'bar', 2, :bam] - * a1 = a.select {|element| element.to_s.start_with?('b') } - * a1 # => ["bar", :bam] - * - * Returns a new Enumerator if no block given: + * a.select {|element| element.to_s.start_with?('b') } + * # => ["bar", :bam] * - * a = [:foo, 'bar', 2, :bam] - * a.select # => #<Enumerator: [:foo, "bar", 2, :bam]:select> + * With no block given, returns a new Enumerator. * + * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching]. */ static VALUE |