Sha256: 110cc9d247beda8ef5c5be78d9f0cbf76a650466570ef284341c34f140759419

Contents?: true

Size: 277 Bytes

Versions: 2

Compression:

Stored size: 277 Bytes

Contents

module Crono
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crono-0.7.0 lib/crono/scheduler.rb
crono-0.6.1 lib/crono/scheduler.rb