Sha256: d32cad2419d1913d70cdcb28116842973feba65f4f60d94634a05c6ffa2fb28d
Contents?: true
Size: 502 Bytes
Versions: 18
Compression:
Stored size: 502 Bytes
Contents
module Faye module Timeouts def add_timeout(name, delay, &block) Faye.ensure_reactor_running! @timeouts ||= {} return if @timeouts.has_key?(name) @timeouts[name] = EventMachine.add_timer(delay) do @timeouts.delete(name) block.call end end def remove_timeout(name) @timeouts ||= {} timeout = @timeouts[name] return if timeout.nil? EventMachine.cancel_timer(timeout) @timeouts.delete(name) end end end
Version data entries
18 entries across 18 versions & 1 rubygems