lib/polyfill/v2_3/array.rb in polyfill-1.2.0 vs lib/polyfill/v2_3/array.rb in polyfill-1.3.0
- old
+ new
@@ -1,7 +1,17 @@
module Polyfill
module V2_3
module Array
+ def bsearch_index
+ unless block_given?
+ return ::Enumerator.new do |yielder|
+ find_index(bsearch { |elem| yielder.yield(elem) })
+ end
+ end
+
+ find_index(bsearch(&::Proc.new))
+ end
+
def dig(head, *rest)
[head, *rest].reduce(self) do |value, accessor|
next_value =
case value
when ::Array