class Continuity::PeriodicEntry

Constants

PERIODS

Public Class Methods

new(s) click to toggle source
# File lib/continuity/periodic_entry.rb, line 11
def initialize(s)
  matches = s.match(/(\d+)([smhdw])/)
  raise "Unable to parse period: #{s}" if matches.nil?

  @period = matches[1].to_i * PERIODS[matches[2]]
end

Public Instance Methods

at?(time) click to toggle source
# File lib/continuity/periodic_entry.rb, line 18
def at?(time)
  time.to_i % @period == 0
end