Class: ActionScheduler
- Defined in:
- lib/delve/scheduler/action_scheduler.rb
Constant Summary collapse
- @@default_duration =
1
Instance Method Summary collapse
- #add(item, repeat, time = @@default_duration) ⇒ Object
- #clear ⇒ Object
-
#initialize(event_queue) ⇒ ActionScheduler
constructor
A new instance of ActionScheduler.
- #next ⇒ Object
- #remove(item) ⇒ Object
- #set_duration(time) ⇒ Object
Methods inherited from Scheduler
Constructor Details
#initialize(event_queue) ⇒ ActionScheduler
Returns a new instance of ActionScheduler.
7 8 9 10 |
# File 'lib/delve/scheduler/action_scheduler.rb', line 7 def initialize(event_queue) @duration = @@default_duration super event_queue end |
Instance Method Details
#add(item, repeat, time = @@default_duration) ⇒ Object
21 22 23 24 |
# File 'lib/delve/scheduler/action_scheduler.rb', line 21 def add(item, repeat, time=@@default_duration) @queue.add item, time super item, repeat end |
#clear ⇒ Object
12 13 14 |
# File 'lib/delve/scheduler/action_scheduler.rb', line 12 def clear super end |
#next ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/delve/scheduler/action_scheduler.rb', line 30 def next if @current and !@repeat.index(@current).nil? @queue.add(@current, @duration || @@default_duration) @duration = @@default_duration end super end |
#remove(item) ⇒ Object
16 17 18 19 |
# File 'lib/delve/scheduler/action_scheduler.rb', line 16 def remove(item) @duration = @@default_duration if item == @current super item end |
#set_duration(time) ⇒ Object
26 27 28 |
# File 'lib/delve/scheduler/action_scheduler.rb', line 26 def set_duration(time) @duration = time if @current end |