Class: RRule::SimpleWeekly

Inherits:
Frequency show all
Defined in:
lib/rrule/frequencies/simple_weekly.rb

Instance Attribute Summary

Attributes inherited from Frequency

#current_date, #filters, #generator, #timeset

Instance Method Summary collapse

Methods inherited from Frequency

#advance, for_options, #initialize

Constructor Details

This class inherits a constructor from RRule::Frequency

Instance Method Details

#correct_current_date_if_neededObject



12
13
14
15
16
17
18
19
20
# File 'lib/rrule/frequencies/simple_weekly.rb', line 12

def correct_current_date_if_needed
  target_wday = if context.options[:byweekday].present?
    context.options[:byweekday].first.index
  else
    context.dtstart.wday
  end

  @current_date += 1.day while @current_date.wday != target_wday
end

#next_occurrencesObject



5
6
7
8
9
10
# File 'lib/rrule/frequencies/simple_weekly.rb', line 5

def next_occurrences
  correct_current_date_if_needed
  this_occurrence = current_date
  @current_date += context.options[:interval].weeks
  generator.process_timeset(this_occurrence, timeset)
end