class TabKeeper::Monthly

Constants

DAY_VALUES

Cron supports 29-31 too, but that's a recipe for sadness

HOUR_VALUES
MINUTE_VALUES

Attributes

day[R]
hour[R]
min[R]

Public Class Methods

new(day: nil, hour: nil, min: 0) click to toggle source
# File lib/tab_keeper/monthly.rb, line 8
def initialize(day: nil, hour: nil, min: 0)
  @day = day
  @hour = hour
  @min = min
  verify!
end

Public Instance Methods

to_s() click to toggle source
# File lib/tab_keeper/monthly.rb, line 15
def to_s
  "#{min} #{hour} #{day} * *"
end

Private Instance Methods

verify!() click to toggle source
# File lib/tab_keeper/monthly.rb, line 23
def verify!
  unless MINUTE_VALUES.include?(min)
    raise ArgumentError, "min must be between 0 and 59"
  end

  unless HOUR_VALUES.include?(hour)
    raise ArgumentError, "hour must be between 0 and 23"
  end

  return if DAY_VALUES.include?(day)
  raise ArgumentError, "day must be between 0 and 28"
end