Object
An individual timer set to fire a given proc at a given time
# File lib/timers.rb, line 116 def <=>(other) @offset <=> other.offset end
Cancel this timer
# File lib/timers.rb, line 121 def cancel @timers.cancel self end
Continue this timer
# File lib/timers.rb, line 152 def continue @timers.continue self end
Extend this timer
# File lib/timers.rb, line 126 def delay(seconds) @timers.delete self @offset += seconds @timers.add self end
Fire the block
# File lib/timers.rb, line 140 def fire(offset = @timers.current_offset) reset(offset) if recurring @block.call end
Inspect a timer
# File lib/timers.rb, line 157 def inspect str = "#<Timers::Timer:#{object_id.to_s(16)} " offset = @timers.current_offset if @offset if @offset >= offset str << "fires in #{@offset - offset} seconds" else str << "fired #{offset - @offset} seconds ago" end str << ", recurs every #{interval}" if recurring else str << "dead" end str << ">" end
Generated with the Darkfish Rdoc Generator 2.