mirror of
https://github.com/plashchynski/crono.git
synced 2026-11-20 15:21:33 +01:00
Add #queue and #next for Schedule
This commit is contained in:
1 parent
518160d5d9
commit
cd925ea952
2 files changed
+19
-4
No files matched your search
@@ -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