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



73
74
75
76
77
# File 'lib/increments/schedule.rb', line 73

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

#find_previousObject



79
80
81
82
83
# File 'lib/increments/schedule.rb', line 79

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