class TabKeeper::Daily

Constants

HOUR_VALUES
MINUTE_VALUES

Attributes

hour[R]
min[R]

Public Class Methods

new(hour: nil, min: 0) click to toggle source
# File lib/tab_keeper/daily.rb, line 6
def initialize(hour: nil, min: 0)
  @hour = hour
  @min = min
  validate!
end

Public Instance Methods

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

Private Instance Methods

validate!() click to toggle source
# File lib/tab_keeper/daily.rb, line 20
def validate!
  unless HOUR_VALUES.include?(hour)
    raise ArgumentError, "hour must be between 0 and 23"
  end

  unless MINUTE_VALUES.include?(min)
    raise ArgumentError, "min must be between 0 and 59"
  end
end