Method: Array#bsearch
- Defined in:
- array.c
#bsearch {|element| ... } ⇒ nil #bsearch ⇒ Object
Returns the element from self
found by a binary search, or nil
if the search found no suitable element.
See Binary Searching.
Related: see Methods for Fetching.
3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 |
# File 'array.c', line 3503
static VALUE
rb_ary_bsearch(VALUE ary)
{
VALUE index_result = rb_ary_bsearch_index(ary);
if (FIXNUM_P(index_result)) {
return rb_ary_entry(ary, FIX2LONG(index_result));
}
return index_result;
}
|