Class: Discordrb::ScheduledEvent::RecurrenceRule

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data/scheduled_event.rb

Overview

Represents how frequently a scheduled event will repeat.

Defined Under Namespace

Classes: Builder, WeeklyDay

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

Instance Method Summary collapse

Instance Attribute Details

#by_monthArray<Integer> (readonly)

Returns the specific months the event can recur on.

Returns:

  • (Array<Integer>)

    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_dayArray<Integer> (readonly)

Returns the specific dates within a month to recur on.

Returns:

  • (Array<Integer>)

    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_weekdayArray<WeeklyDay> (readonly)

Returns the specific days within a specific week to recur on.

Returns:

  • (Array<WeeklyDay>)

    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_weekdayArray<Integer> (readonly)

Returns the specific days of the week the event can recur on.

Returns:

  • (Array<Integer>)

    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_dayArray<Integer> (readonly)

Returns the specific days within the year (1-364) to recur on.

Returns:

  • (Array<Integer>)

    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

#countInteger? (readonly)

Returns the amount of times that the event can recur before stopping.

Returns:

  • (Integer, nil)

    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_timeTime? (readonly)

Returns the time at when the reccurence interval will end.

Returns:

  • (Time, nil)

    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

#frequencyInteger (readonly)

Returns how often the reccurence interval will occur, e.g. yearly, monthly.

Returns:

  • (Integer)

    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

#intervalInteger (readonly)

Returns The spacing between the events, defined by the frequency.

Returns:

  • (Integer)

    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_timeTime (readonly)

Returns the time at when the reccurence interval will start.

Returns:

  • (Time)

    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.

Returns:

  • (true, false)

    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.

Returns:

  • (true, false)

    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.

Returns:

  • (true, false)

    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.

Returns:

  • (true, false)

    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