Class: Discordrb::ScheduledEvent::RecurrenceRule::Builder

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

Overview

Builder for the reccurence rule.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#frequency=(value) ⇒ void (writeonly)

This method returns an undefined value.

Parameters:

  • value (Integer, String)

    how frequently the scheduled event should occur.



434
435
436
# File 'lib/discordrb/data/scheduled_event.rb', line 434

def frequency=(value)
  @frequency = value
end

#interval=(value) ⇒ void (writeonly)

This method returns an undefined value.

Parameters:

  • value (Integer)

    the spacing between the events, defined by the frequency.



429
430
431
# File 'lib/discordrb/data/scheduled_event.rb', line 429

def interval=(value)
  @interval = value
end

#start_time=(value) ⇒ void (writeonly)

This method returns an undefined value.

Parameters:

  • value (Time, #iso8601)

    the time at when the reccurence interval will begin.



439
440
441
# File 'lib/discordrb/data/scheduled_event.rb', line 439

def start_time=(value)
  @start_time = value
end

Instance Method Details

#by_month=(months) ⇒ void

This method returns an undefined value.

Set the the specific months of the year to recur on.

Parameters:

  • months (Array<Integer, Symbol>, Integer, Symbol)

    The specific months of the year to recur on, e.g. :april, :july, :june, etc.



460
461
462
# File 'lib/discordrb/data/scheduled_event.rb', line 460

def by_month=(months)
  @by_month = Array(months).map { |month| MONTHS[month] || month }
end

#by_month_day=(monthly_days) ⇒ void

This method returns an undefined value.

Set the the specific days within the month to recur on.

Parameters:

  • monthly_days (Array<Integer>)

    The speific days within the month to recur on.



452
453
454
# File 'lib/discordrb/data/scheduled_event.rb', line 452

def by_month_day=(monthly_days)
  @by_month_day = Array(monthly_days).map(&:to_i)
end

#by_n_weekday(week:, day:) ⇒ void

This method returns an undefined value.

Set the specific days for a specific week to recur on.

Parameters:

  • week (Integer)

    The week of the month (1-5) to recur on.

  • day (Integer, Symbol)

    The specific day of the week to recur on, e.g. :april.



476
477
478
# File 'lib/discordrb/data/scheduled_event.rb', line 476

def by_n_weekday(week:, day:)
  (@by_n_weekday ||= []) << { n: week, day: WEEKDAYS[day] || day }
end

#by_weekday=(weekdays) ⇒ void

This method returns an undefined value.

Set the specific days of the week to recur on.

Parameters:

  • weekdays (Array<Symbol, Integer>, Symbol, Integer)

    The specific days of the week to recur on, e.g. :tuesday, :saturday, etc.



468
469
470
# File 'lib/discordrb/data/scheduled_event.rb', line 468

def by_weekday=(weekdays)
  @by_weekday = Array(weekdays).map { |day| WEEKDAYS[day] || day }
end