Sha256: d94e268648cb5e191194436a269f2ed6d5536269f65916c4b5d658afb7f30b0c
Contents?: true
Size: 748 Bytes
Versions: 1
Compression:
Stored size: 748 Bytes
Contents
class Ztimer class Slot attr_reader :enqueued_at, :expires_at, :recurrency, :callback attr_accessor :started_at, :executed_at 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 def recurrent? return @recurrency > 0 end def reset! if recurrent? @expires_at += recurrency end end def canceled? return @canceled end def cancel! @canceled = true end def <=>(other) return @expires_at <=> other.expires_at end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ztimer-0.6.0 | lib/ztimer/slot.rb |