Date_Range.index_of
index_ofconditionstart
Group: Values
Documentation
Returns the index of an element in the range. Returns Nothing if the element is not found.
Arguments
condition
: Either the element to search for, aFilter_Condition
or a predicate function to test each element.start
: The index to start searching from. If the index is negative, it is counted from the end of the range.
Examples
Find the index of a first day that is a Monday.
(Date.new 2020 10 01).up_to (Date.new 2020 10 31) . index_of (d-> d.day_of_week == Day_Of_Week.Monday)