Class Timer
In: lib/rbot/timer.rb
Parent: Object

Timer handler, manage multiple Action objects, calling them when required. When the Timer is constructed, a new Thread is created to manage timed delays and run Actions.

XXX: there is no way to stop the timer currently. I‘m keeping it this way to weed out old Timer implementation legacy in rbot code. -jsn.

Methods

[]   add   add_once   block   configure   delete   new   remove   reschedule   run_actions   start   stop   unblock  

Classes and Modules

Class Timer::Action

Public Class methods

creates a new Timer and starts it.

Public Instance methods

Creates and installs a new Action, repeatable by default.

period:Action period
opts:options for Action#new, see there
block:Action callback code

Returns the id of the created Action

Creates and installs a new Action, one-time by default.

period:Action delay
opts:options for Action#new, see there
block:Action callback code

Returns the id of the created Action

blocks an existing Action

aid:Action id, obtained previously from add() or add_once()

Provides for on-the-fly reconfiguration of Actions

aid:Action id, obtained previously from add() or add_once()
opts:see Action#new
block:(optional) new Action callback code
delete(aid)

Alias for remove

removes an existing blocked Action

aid:Action id, obtained previously from add() or add_once()

changes Action period

aid:Action id
period:new period
block:(optional) new Action callback code

unblocks an existing blocked Action

aid:Action id, obtained previously from add() or add_once()

Protected Instance methods

[Validate]