Sha256: 0b4a0ef0d48baf5db6dd1a7f3f66c43fb71370ef50c30c033e04afdf090fa55b

Contents?: true

Size: 542 Bytes

Versions: 3

Compression:

Stored size: 542 Bytes

Contents

module Ztimer
  class Slot
    attr_reader :enqueued_at, :expires_at, :callback
    attr_accessor :started_at, :executed_at

    def initialize(enqueued_at, expires_at, &callback)
      @enqueued_at = enqueued_at
      @expires_at  = expires_at
      @callback    = callback
      @started_at  = nil
      @executed_at = nil
      @canceled    = false
    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

3 entries across 3 versions & 1 rubygems

Version Path
ztimer-0.3.2 lib/ztimer/slot.rb
ztimer-0.3.1 lib/ztimer/slot.rb
ztimer-0.3.0 lib/ztimer/slot.rb