@@ -1213,7 +1213,7 @@ class Array[unchecked out Elem] < Object
12131213 # Returns the element from `self` found by a binary search, or `nil` if the
12141214 # search found no suitable element.
12151215 #
1216- # See [Binary Searching](rdoc-ref:bsearch.rdoc).
1216+ # See [Binary Searching](rdoc-ref:language/ bsearch.rdoc).
12171217 #
12181218 # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
12191219 #
@@ -1229,7 +1229,7 @@ class Array[unchecked out Elem] < Object
12291229 # Returns the integer index of the element from `self` found by a binary search,
12301230 # or `nil` if the search found no suitable element.
12311231 #
1232- # See [Binary Searching](rdoc-ref:bsearch.rdoc).
1232+ # See [Binary Searching](rdoc-ref:language/ bsearch.rdoc).
12331233 #
12341234 # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
12351235 #
@@ -2019,6 +2019,30 @@ class Array[unchecked out Elem] < Object
20192019 def filter! : () { (Elem item) -> boolish } -> self ?
20202020 | () -> ::Enumerator[Elem, self ?]
20212021
2022+ # <!--
2023+ # rdoc-file=array.c
2024+ # - find(if_none_proc = nil) {|element| ... } -> object or nil
2025+ # - find(if_none_proc = nil) -> enumerator
2026+ # -->
2027+ # Returns the first element for which the block returns a truthy value.
2028+ #
2029+ # With a block given, calls the block with successive elements of the array;
2030+ # returns the first element for which the block returns a truthy value:
2031+ #
2032+ # [1, 3, 5].find {|element| element > 2} # => 3
2033+ #
2034+ # If no such element is found, calls `if_none_proc` and returns its return
2035+ # value.
2036+ #
2037+ # [1, 3, 5].find(proc {-1}) {|element| element > 12} # => -1
2038+ #
2039+ # With no block given, returns an Enumerator.
2040+ #
2041+ def find : () { (Elem) -> boolish } -> Elem?
2042+ | () -> ::Enumerator[Elem, Elem?]
2043+ | [T] (Enumerable::_NotFound[T] ifnone) { (Elem) -> boolish } -> (Elem | T)
2044+ | [T] (Enumerable::_NotFound[T] ifnone) -> ::Enumerator[Elem, Elem | T]
2045+
20222046 # <!--
20232047 # rdoc-file=array.c
20242048 # - find_index(object) -> integer or nil
@@ -2618,7 +2642,7 @@ class Array[unchecked out Elem] < Object
26182642 # - pack(template, buffer: nil) -> string
26192643 # -->
26202644 # Formats each element in `self` into a binary string; returns that string. See
2621- # [Packed Data](rdoc-ref:packed_data.rdoc).
2645+ # [Packed Data](rdoc-ref:language/ packed_data.rdoc).
26222646 #
26232647 def pack : (string fmt, ?buffer: String?) -> String
26242648
@@ -2988,6 +3012,31 @@ class Array[unchecked out Elem] < Object
29883012 def reverse_each : () { (Elem item) -> void } -> self
29893013 | () -> ::Enumerator[Elem, self ]
29903014
3015+ # <!--
3016+ # rdoc-file=array.c
3017+ # - rfind(if_none_proc = nil) {|element| ... } -> object or nil
3018+ # - rfind(if_none_proc = nil) -> enumerator
3019+ # -->
3020+ # Returns the last element for which the block returns a truthy value.
3021+ #
3022+ # With a block given, calls the block with successive elements of the array in
3023+ # reverse order; returns the first element for which the block returns a truthy
3024+ # value:
3025+ #
3026+ # [1, 2, 3, 4, 5, 6].rfind {|element| element < 5} # => 4
3027+ #
3028+ # If no such element is found, calls `if_none_proc` and returns its return
3029+ # value.
3030+ #
3031+ # [1, 2, 3, 4].rfind(proc {0}) {|element| element < -2} # => 0
3032+ #
3033+ # With no block given, returns an Enumerator.
3034+ #
3035+ def rfind : () { (Elem) -> boolish } -> Elem?
3036+ | () -> ::Enumerator[Elem, Elem?]
3037+ | [T] (Enumerable::_NotFound[T] ifnone) { (Elem) -> boolish } -> (Elem | T)
3038+ | [T] (Enumerable::_NotFound[T] ifnone) -> ::Enumerator[Elem, Elem | T]
3039+
29913040 # <!--
29923041 # rdoc-file=array.c
29933042 # - rindex(object) -> integer or nil
0 commit comments