class Que::Scheduler::SchedulerJobArgs

Public Class Methods

build(options) click to toggle source
# File lib/que/scheduler/scheduler_job_args.rb, line 13
def self.build(options)
  now = Que::Scheduler::Db.now
  parsed =
    if options.nil?
      # First ever run, there is nothing to do but reschedule self to run on the next minute.
      {
        last_run_time: now,
        job_dictionary: [],
      }
    else
      options = options.symbolize_keys
      {
        last_run_time:
          Que::Scheduler::TimeZone.time_zone.parse(options.fetch(:last_run_time)),
        job_dictionary: options.fetch(:job_dictionary),
      }
    end
  SchedulerJobArgs.new(parsed.merge(as_time: now))
end