Sha256: 32c83503224050e6625405d502f63b291ea554b782038fb9fe318ec102678eb0
Contents?: true
Size: 534 Bytes
Versions: 7
Compression:
Stored size: 534 Bytes
Contents
module Larynx # Adds restart to EM timer class. Implementation influenced by EM::PeriodicTimer class # so hopefully it should not cause any issues. class RestartableTimer < EM::Timer def initialize(interval, callback=nil, &block) @interval = interval @code = callback || block schedule end # Restart the timer def restart cancel schedule end def schedule @signature = EM::add_timer(@interval, method(:fire)) end def fire @code.call end end end
Version data entries
7 entries across 7 versions & 1 rubygems