Class: Increments::Schedule::ExtendedDate

Inherits:
Date
  • Object
show all
Defined in:
lib/increments/schedule.rb

Constant Summary collapse

INFINITY_FUTURE =
Date.new(10_000, 1, 1)
INFINITY_PAST =
Date.new(0, 1, 1)

Instance Method Summary collapse

Instance Method Details

#find_nextObject



96
97
98
99
100
# File 'lib/increments/schedule.rb', line 96

def find_next
  upto(INFINITY_FUTURE) do |date|
    break date if yield date
  end
end

#find_previousObject



102
103
104
105
106
# File 'lib/increments/schedule.rb', line 102

def find_previous
  downto(INFINITY_PAST) do |date|
    break date if yield date
  end
end