Object
Creates a periodic timer
n = 0 timer = EventMachine::PeriodicTimer.new(5) do puts "the time is #{Time.now}" timer.cancel if (n+=1) > 5 end
Fire the timer every interval seconds
Create a new periodic timer that executes every interval seconds
# File lib/em/timers.rb, line 31 def initialize interval, callback=nil, &block @interval = interval @code = callback || block @cancelled = false schedule end
Cancel the periodic timer
# File lib/em/timers.rb, line 39 def cancel @cancelled = true end
[Validate]
Generated with the Darkfish Rdoc Generator 2.