Class: Rack::Timeout::Scheduler::RunEvent

Inherits:
Struct
  • Object
show all
Defined in:
lib/rack/timeout/support/scheduler.rb

Overview

stores a proc to run later, and the time it should run at

Direct Known Subclasses

RepeatEvent

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#monotimeObject

Returns the value of attribute monotime

Returns:

  • (Object)

    the current value of monotime



23
24
25
# File 'lib/rack/timeout/support/scheduler.rb', line 23

def monotime
  @monotime
end

#procObject

Returns the value of attribute proc

Returns:

  • (Object)

    the current value of proc



23
24
25
# File 'lib/rack/timeout/support/scheduler.rb', line 23

def proc
  @proc
end

Instance Method Details

#cancel!Object



24
25
26
# File 'lib/rack/timeout/support/scheduler.rb', line 24

def cancel!
  @cancelled = true
end

#cancelled?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/rack/timeout/support/scheduler.rb', line 28

def cancelled?
  !!@cancelled
end

#run!Object



32
33
34
35
# File 'lib/rack/timeout/support/scheduler.rb', line 32

def run!
  return if @cancelled
  proc.call(self)
end