Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Array#bsearch_index

array.bsearch_index {|element| ... } → integer or nil
array.bsearch_index → new_enumerator

Searches self as described at method bsearch, but returns the index of the found element instead of the element itself.

See also #bsearch #clear #at #collect also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1