Sha256: dc47165d941d3f8ee16511dfae4d9c37678feb43f2e2d0cbaf4b371f0e9ea654

Contents?: true

Size: 321 Bytes

Versions: 2

Compression:

Stored size: 321 Bytes

Contents

module Crono
  class Schedule
    def initialize
      @schedule = []
    end

    def add(peformer, period)
      @schedule << [peformer, period]
    end

    def next
      [queue.first[0], queue.first[1].next]
    end

    private
    def queue
      @schedule.sort { |a,b| a[1].next <=> b[1].next }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crono-0.5.1 lib/crono/schedule.rb
crono-0.5.0 lib/crono/schedule.rb