In Files

Parent

Methods

EventMachine::Timer

Creates a one-time timer

 timer = EventMachine::Timer.new(5) do
   # this will never fire because we cancel it
 end
 timer.cancel

Public Class Methods

new(interval, callback=nil, &block) click to toggle source

Create a new timer that fires after a given number of seconds

    # File lib/em/timers.rb, line 11
11:     def initialize interval, callback=nil, &block
12:       @signature = EventMachine::add_timer(interval, callback || block)
13:     end

Public Instance Methods

cancel() click to toggle source

Cancel the timer

    # File lib/em/timers.rb, line 16
16:     def cancel
17:       EventMachine.send :cancel_timer, @signature
18:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.