Class: Gamelan::Scheduler
Overview
The scheduler allows the user to schedule tasks, represented by Gamelan::Task.
Instance Attribute Summary
Attributes inherited from Timer
Instance Method Summary collapse
-
#at(delay, *params, &task) ⇒ Object
Schedule a task to be performed at
delaybeats. -
#initialize(options = {}) ⇒ Scheduler
constructor
Construct a new scheduler.
Methods inherited from Timer
#join, #run, #stop, #tempo, #tempo=
Constructor Details
#initialize(options = {}) ⇒ Scheduler
Construct a new scheduler. Scheduler#run must be called explicitly once a Scheduler is created. Accepts two options, :tempo and :rate.
[+:tempo+] The tempo's scheduler, in bpm. For example, at :tempo => 120, the scheduler's logical phase will advance by 2.0 every 60 seconds.
[+:rate+] Frequency in Hz at which the scheduler will attempt to run ready tasks. For example, The scheduler will poll for tasks 100 times in one
second when :rate is 100.
12 13 14 15 |
# File 'lib/gamelan/scheduler.rb', line 12 def initialize( = {}) super @queue = Gamelan::Queue.new(self) end |