def pattern
      ranges = dates.group_by(&:wday).values.map { |weekdates| (weekdates.min..weekdates.max) }
      TemporalPatterns::Pattern.new(ranges, 1.week)
    end
def pattern
      ranges = dates.group_by(&:wday).values.map { |weekdates| (weekdates.min..weekdates.max) }
      TemporalPatterns::Pattern.new(ranges, 1.week)
    end
---------------- Date intervals and patterns -----------------