Class: Discordrb::ScheduledEvent::RecurrenceRule
- Inherits:
-
Object
- Object
- Discordrb::ScheduledEvent::RecurrenceRule
- Defined in:
- lib/discordrb/data/scheduled_event.rb
Overview
Represents how frequently a scheduled event will repeat.
Defined Under Namespace
Constant Summary collapse
- WEEKDAYS =
Map of weekdays.
{ monday: 0, tuesday: 1, wednesday: 2, thursday: 3, friday: 4, saturday: 5, sunday: 6 }.freeze
- FREQUENCIES =
Map of frequencies.
{ yearly: 0, monthly: 1, weekly: 2, daily: 3 }.freeze
- MONTHS =
Map of months.
{ january: 1, february: 2, march: 3, april: 4, may: 5, june: 6, july: 7, august: 8, september: 9, october: 10, november: 11, december: 12 }.freeze
Instance Attribute Summary collapse
-
#by_month ⇒ Array<Integer>
readonly
The specific months the event can recur on.
-
#by_month_day ⇒ Array<Integer>
readonly
The specific dates within a month to recur on.
-
#by_n_weekday ⇒ Array<WeeklyDay>
readonly
The specific days within a specific week to recur on.
-
#by_weekday ⇒ Array<Integer>
readonly
The specific days of the week the event can recur on.
-
#by_year_day ⇒ Array<Integer>
readonly
The specific days within the year (1-364) to recur on.
-
#count ⇒ Integer?
readonly
The amount of times that the event can recur before stopping.
-
#end_time ⇒ Time?
readonly
The time at when the reccurence interval will end.
-
#frequency ⇒ Integer
readonly
How often the reccurence interval will occur, e.g.
-
#interval ⇒ Integer
readonly
The spacing between the events, defined by the frequency.
-
#start_time ⇒ Time
readonly
The time at when the reccurence interval will start.
Instance Method Summary collapse
-
#daily? ⇒ true, false
Whether the event repeat on a daily basis.
-
#monthly? ⇒ true, false
Whether the event repeat on a monthly basis.
-
#weekly? ⇒ true, false
Whether the event repeat on a weekly basis.
-
#yearly? ⇒ true, false
Whether the event repeat on a yearly basis.
Instance Attribute Details
#by_month ⇒ Array<Integer> (readonly)
Returns the specific months the event can recur on.
312 313 314 |
# File 'lib/discordrb/data/scheduled_event.rb', line 312 def by_month @by_month end |
#by_month_day ⇒ Array<Integer> (readonly)
Returns the specific dates within a month to recur on.
336 337 338 |
# File 'lib/discordrb/data/scheduled_event.rb', line 336 def by_month_day @by_month_day end |
#by_n_weekday ⇒ Array<WeeklyDay> (readonly)
Returns the specific days within a specific week to recur on.
333 334 335 |
# File 'lib/discordrb/data/scheduled_event.rb', line 333 def by_n_weekday @by_n_weekday end |
#by_weekday ⇒ Array<Integer> (readonly)
Returns the specific days of the week the event can recur on.
321 322 323 |
# File 'lib/discordrb/data/scheduled_event.rb', line 321 def by_weekday @by_weekday end |
#by_year_day ⇒ Array<Integer> (readonly)
Returns the specific days within the year (1-364) to recur on.
330 331 332 |
# File 'lib/discordrb/data/scheduled_event.rb', line 330 def by_year_day @by_year_day end |
#count ⇒ Integer? (readonly)
Returns the amount of times that the event can recur before stopping.
309 310 311 |
# File 'lib/discordrb/data/scheduled_event.rb', line 309 def count @count end |
#end_time ⇒ Time? (readonly)
Returns the time at when the reccurence interval will end.
315 316 317 |
# File 'lib/discordrb/data/scheduled_event.rb', line 315 def end_time @end_time end |
#frequency ⇒ Integer (readonly)
Returns how often the reccurence interval will occur, e.g. yearly, monthly.
327 328 329 |
# File 'lib/discordrb/data/scheduled_event.rb', line 327 def frequency @frequency end |
#interval ⇒ Integer (readonly)
Returns The spacing between the events, defined by the frequency.
324 325 326 |
# File 'lib/discordrb/data/scheduled_event.rb', line 324 def interval @interval end |
#start_time ⇒ Time (readonly)
Returns the time at when the reccurence interval will start.
318 319 320 |
# File 'lib/discordrb/data/scheduled_event.rb', line 318 def start_time @start_time end |
Instance Method Details
#daily? ⇒ true, false
Returns whether the event repeat on a daily basis.
377 378 379 380 381 |
# File 'lib/discordrb/data/scheduled_event.rb', line 377 FREQUENCIES.each do |name, value| define_method("#{name}?") do @frequency == value end end |
#monthly? ⇒ true, false
Returns whether the event repeat on a monthly basis.
377 378 379 380 381 |
# File 'lib/discordrb/data/scheduled_event.rb', line 377 FREQUENCIES.each do |name, value| define_method("#{name}?") do @frequency == value end end |
#weekly? ⇒ true, false
Returns whether the event repeat on a weekly basis.
377 378 379 380 381 |
# File 'lib/discordrb/data/scheduled_event.rb', line 377 FREQUENCIES.each do |name, value| define_method("#{name}?") do @frequency == value end end |
#yearly? ⇒ true, false
Returns whether the event repeat on a yearly basis.
377 378 379 380 381 |
# File 'lib/discordrb/data/scheduled_event.rb', line 377 FREQUENCIES.each do |name, value| define_method("#{name}?") do @frequency == value end end |