class Ztimer::Slot
Attributes
callback[R]
enqueued_at[R]
executed_at[RW]
expires_at[R]
recurrency[R]
started_at[RW]
Public Class Methods
new(enqueued_at, expires_at,recurrency = -1, &callback)
click to toggle source
# File lib/ztimer/slot.rb, line 7 def initialize(enqueued_at, expires_at,recurrency = -1, &callback) @enqueued_at = enqueued_at @expires_at = expires_at @recurrency = recurrency @callback = callback @started_at = nil @executed_at = nil @canceled = false end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/ztimer/slot.rb, line 35 def <=>(other) return @expires_at <=> other.expires_at end
cancel!()
click to toggle source
# File lib/ztimer/slot.rb, line 31 def cancel! @canceled = true end
canceled?()
click to toggle source
# File lib/ztimer/slot.rb, line 27 def canceled? return @canceled end
recurrent?()
click to toggle source
# File lib/ztimer/slot.rb, line 17 def recurrent? return @recurrency > 0 end
reset!()
click to toggle source
# File lib/ztimer/slot.rb, line 21 def reset! if recurrent? @expires_at += recurrency end end