class Timers
Nested
Definitions
def schedule(time, block)
Schedule a block to be called at a specific time in the future.
Signature
-
parameter
time
Float
The time at which the block should be called, relative to
#now
.
Implementation
def schedule(time, block)
handle = Handle.new(time, block)
@scheduled << handle
return handle
end
def after(offset, &block)
Schedule a block to be called after a specific time offset, relative to the current time as returned by #now
.
Signature
-
parameter
offset
#to_f
The time offset from the current time at which the block should be called.
Implementation
def after(offset, &block)
schedule(self.now + offset.to_f, block)
end