First Occurrence of Number in Binary Search?
Not exactly a code review, but did you know that ruby 2 introduces binary search for arrays ? 

See : Array#bsearch. 

your problem could be solved like this: 

myarray.each_with_index.to_a.bsearch{|(x,index)| x == n}
# =&gt; if found, returns an array containing the number and the index