|
Class Ltimer |
Home |
|
l_timer.rb - this is a timer used by Locana.
Author: Michael Davis, mdavis@locana.org
Copyright: (C) 2000, 2001, 2002 Seva Inc. and Seva Software - www.sevasoftware.com
Home page: www.locana.org
License: Same as Ruby
Provides timer support for Locana.
Status:
To do:
When a block or Proc object is provided with the timer during new() or start(), the block or Proc object will be called when the timer matures. If a block or Proc object is not provided the :on_timer event is triggered when the timer matures. The timer fires only once and must be started again if you want it to repeat.
This needs to be defined or loaded before loading any modules because some of the other modules create a timer when they load. Ltimer.new(2000).start{|timer| puts "this timer fires in 2 seconds"} proc_obj = proc{|timer| puts "this timer fires every 2 seconds"; timer.start()} Ltimer.new(2000, proc_obj).start
| Methods |
| Attributes |
| [RW] | millisecs |
| Public Class methods |
| new(millisecs=nil, proc_object=nil) src |
Creates a new timer
| Public Instance methods |
| start(millisecs=nil, &block) src |
Starts the timer and yields block when the timer expires. If the timer is currently running, this restarts it and cancels the original timer. If the object has been assigned a proc_object, it is called when the time expires.
| cancel() src |
Cancels the timer.
| stop() |
Alias for cancel
| fire() src |
Fires the timer.
| trigger() |
Alias for fire
| is_active?() src |
Returns true if the timer is active.
| Seva Software |
Thank you for taking the time to visit this web page. I trust you found the information contained in this page useful.
Please email any questions, concerns, or issues with this web site to webmaster@sevasoftware.com.
Please remember Seva Software when your company would benefit from an experienced database architect and software engineer.