Class: Rack::Timeout::Scheduler::RunEvent
- Inherits:
-
Struct
- Object
- Struct
- Rack::Timeout::Scheduler::RunEvent
- 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
Instance Attribute Summary collapse
-
#monotime ⇒ Object
Returns the value of attribute monotime.
-
#proc ⇒ Object
Returns the value of attribute proc.
Instance Method Summary collapse
- #cancel! ⇒ Object
- #cancelled? ⇒ Boolean
-
#initialize(*args) ⇒ RunEvent
constructor
A new instance of RunEvent.
- #run! ⇒ Object
Constructor Details
#initialize(*args) ⇒ RunEvent
Returns a new instance of RunEvent.
23 24 25 26 |
# File 'lib/rack/timeout/support/scheduler.rb', line 23 def initialize(*args) @cancelled = false super(*args) end |
Instance Attribute Details
#monotime ⇒ Object
Returns the value of attribute monotime
22 23 24 |
# File 'lib/rack/timeout/support/scheduler.rb', line 22 def monotime @monotime end |
#proc ⇒ Object
Returns the value of attribute proc
22 23 24 |
# File 'lib/rack/timeout/support/scheduler.rb', line 22 def proc @proc end |
Instance Method Details
#cancel! ⇒ Object
28 29 30 |
# File 'lib/rack/timeout/support/scheduler.rb', line 28 def cancel! @cancelled = true end |
#cancelled? ⇒ Boolean
32 33 34 |
# File 'lib/rack/timeout/support/scheduler.rb', line 32 def cancelled? !!@cancelled end |
#run! ⇒ Object
36 37 38 39 |
# File 'lib/rack/timeout/support/scheduler.rb', line 36 def run! return if @cancelled proc.call(self) end |