summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorVictor Shepelev <zverok.offline@gmail.com>2025-12-20 13:07:38 +0200
committerGitHub <noreply@github.com>2025-12-20 13:07:38 +0200
commitec4ca91319212ac9109ceac305f527c998da1738 (patch)
treed9c184b52df90028705b97e88636049316d81e6d /array.c
parent77c3a9e447ec477be39e00072e1ce3348d0f4533 (diff)
Small documentation adjustments for new/updated features (#15634)
* Document Range#to_set * Update Thread#raise and Fiber#raise signatures and docs * Add reference to String#strip to character_selectors.rdoc * Update *nil docs when calling methods * Enhance Array#find and #rfind docs * Add a notice to Kernel#raise about cause:
Diffstat (limited to 'array.c')
-rw-r--r--array.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/array.c b/array.c
index 27b84249bf..e13239ad3d 100644
--- a/array.c
+++ b/array.c
@@ -2102,9 +2102,7 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary)
*
* If no such element is found, calls +if_none_proc+ and returns its return value.
*
- * [1, 3, 5].find(proc {false}) {|element| element > 12} # => false
- * [[:foo, 0], [:bar, 1], [:baz, 2]].find {|key, value| key.start_with?('b') } # => [:bar, 1]
- * [[:foo, 0], [:bar, 1], [:baz, 2]].find(proc {[]}) {|key, value| key.start_with?('c') } # => []
+ * [1, 3, 5].find(proc {-1}) {|element| element > 12} # => -1
*
* With no block given, returns an Enumerator.
*
@@ -2140,16 +2138,14 @@ rb_ary_find(int argc, VALUE *argv, VALUE ary)
* Returns the last element for which the block returns a truthy value.
*
* With a block given, calls the block with successive elements of the array in
- * reverse order; returns the last element for which the block returns a truthy
+ * reverse order; returns the first element for which the block returns a truthy
* value:
*
- * (0..9).rfind {|element| element < 5} # => 4
+ * [1, 2, 3, 4, 5, 6].rfind {|element| element < 5} # => 4
*
* If no such element is found, calls +if_none_proc+ and returns its return value.
*
- * (0..9).rfind(proc {false}) {|element| element < -2} # => false
- * {foo: 0, bar: 1, baz: 2}.rfind {|key, value| key.start_with?('b') } # => [:baz, 2]
- * {foo: 0, bar: 1, baz: 2}.rfind(proc {[]}) {|key, value| key.start_with?('c') } # => []
+ * [1, 2, 3, 4].rfind(proc {0}) {|element| element < -2} # => 0
*
* With no block given, returns an Enumerator.
*