Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/binary_search/pure.rb
Instance Method Summary collapse
Instance Method Details
#binary_index(value) ⇒ Object
12 13 14 |
# File 'ext/binary_search.c', line 12 def binary_index(target) binary_chop { |v| target <=> v } end |
#binary_search(&block) ⇒ Object
6 7 8 9 |
# File 'lib/binary_search/pure.rb', line 6 def binary_search(&block) index = binary_chop(&block) index ? self[index] : nil end |