lib/repeatable/schedule.rb in repeatable-0.6.0 vs lib/repeatable/schedule.rb in repeatable-1.0.0

- old
+ new

@@ -10,20 +10,20 @@ fail(ParseError, "Can't build a Repeatable::Schedule from #{arg.class}") end end def occurrences(start_date, end_date) - start_date = Date(start_date) - end_date = Date(end_date) + start_date = Conversions::Date(start_date) + end_date = Conversions::Date(end_date) - fail(ArgumentError, 'end_date must be equal to or after start_date') if end_date < start_date + fail(ArgumentError, "end_date must be equal to or after start_date") if end_date < start_date (start_date..end_date).select { |date| include?(date) } end def next_occurrence(start_date = Date.today, include_start: false, limit: 36525) - date = Date(start_date) + date = Conversions::Date(start_date) return date if include_start && include?(date) 1.step do |i| date = date.next_day @@ -32,10 +32,10 @@ break if i == limit.to_i end end def include?(date = Date.today) - date = Date(date) + date = Conversions::Date(date) expression.include?(date) end def to_h expression.to_h