class Rufus::Scheduler

def step_trigger


cron jobs.
triggers every eligible pending (at or every) jobs, then every eligible
def step_trigger
  now = Time.now
  if @exit_when_no_more_jobs && @pending_jobs.size < 1
    @stopped = true
    return
  end
  # TODO : eventually consider running cron / pending
  # job triggering in two different threads
  #
  # but well... there's the synchronization issue...
  #
  # cron jobs
  if now.sec != @last_cron_second
    @last_cron_second = now.sec
    @cron_jobs.each do |cron_id, cron_job|
      #trigger(cron_job) if cron_job.matches?(now, @precision)
      cron_job.trigger if cron_job.matches?(now)
    end
  end
  #
  # pending jobs
  now = now.to_f
    #
    # that's what at jobs do understand
  loop do
    break if @pending_jobs.length < 1
    job = @pending_jobs[0]
    break if job.at > now
    #if job.at <= now
      #
      # obviously
    job.trigger
    @pending_jobs.delete_at 0
  end
end