Is there a built-in Array or Enumerable array that allows me to search for an element using a block and return its index?
Something along the lines of:
ar = [15,2,33,4,50,69]
indexes = ar.find_indexes {|item| item > 4 == 0}
It would be very easy to add my own, but I would like to know if this already exists?
source
share