mirror of
https://github.com/plashchynski/crono.git
synced 2026-03-17 23:14:14 +01:00
Add #queue and #next for Schedule
This commit is contained in:
@@ -5,6 +5,16 @@ module Crono
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user