Sha256: 8cdcceeb387e32999c4c753838587248f779db27310f5eb854a1483dc43acd21

Contents?: true

Size: 361 Bytes

Versions: 1

Compression:

Stored size: 361 Bytes

Contents

module Crono
  # Scheduler is a container for job list and queue
  class Scheduler
    attr_accessor :jobs

    def initialize
      self.jobs = []
    end

    def add_job(job)
      job.load
      jobs << job
    end

    def next
      queue.first
    end

    private

    def queue
      jobs.sort_by(&:next)
    end
  end

  mattr_accessor :scheduler
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crono-0.8.1 lib/crono/scheduler.rb