class SardonyxRing::Handlers::CronHandler

Attributes

cron_format[R]

Public Class Methods

new(cron_format, callback) click to toggle source
# File lib/sardonyx_ring/handlers/cron_handler.rb, line 6
def initialize(cron_format, callback)
  @cron_format = cron_format
  @callback = callback
end

Public Instance Methods

next_time(current_time = Time.now) click to toggle source
# File lib/sardonyx_ring/handlers/cron_handler.rb, line 17
def next_time(current_time = Time.now)
  cron.next(current_time)
end
run(app) click to toggle source
# File lib/sardonyx_ring/handlers/cron_handler.rb, line 13
def run(app)
  @callback.bind(app).call
end

Private Instance Methods

cron() click to toggle source
# File lib/sardonyx_ring/handlers/cron_handler.rb, line 23
def cron
  @cron ||= CronParser.new(cron_format)
end