lib/hiccup/enumerable/never_enumerator.rb in hiccup-0.5.0 vs lib/hiccup/enumerable/never_enumerator.rb in hiccup-0.5.1
- old
+ new
@@ -3,15 +3,24 @@
module Hiccup
module Enumerable
class NeverEnumerator < ScheduleEnumerator
+ def next
+ @cursor = @cursor ? nil : first_occurrence_on_or_after(seed_date)
+ end
+
+ def prev
+ @cursor = @cursor ? nil : first_occurrence_on_or_before(seed_date)
+ end
+
+
def first_occurrence_on_or_after(date)
- date if date == start_date
+ start_date if date <= start_date
end
def first_occurrence_on_or_before(date)
- date
+ start_date unless date < start_date
end
end
end