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
-
#proc ⇒ Object
Returns the value of attribute proc.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
- #cancel! ⇒ Object
- #cancelled? ⇒ Boolean
-
#initialize(time, proc) ⇒ RunEvent
constructor
A new instance of RunEvent.
- #run! ⇒ Object
Constructor Details
#initialize(time, proc) ⇒ RunEvent
Returns a new instance of RunEvent.
24 25 26 27 |
# File 'lib/rack/timeout/support/scheduler.rb', line 24 def initialize(time, proc) Rack::Timeout::AssertTypes.assert_types! time => Time, proc => Proc super end |
Instance Attribute Details
#proc ⇒ Object
Returns the value of attribute proc
23 24 25 |
# File 'lib/rack/timeout/support/scheduler.rb', line 23 def proc @proc end |
#time ⇒ Object
Returns the value of attribute time
23 24 25 |
# File 'lib/rack/timeout/support/scheduler.rb', line 23 def time @time end |
Instance Method Details
#cancel! ⇒ Object
29 30 31 |
# File 'lib/rack/timeout/support/scheduler.rb', line 29 def cancel! @cancelled = true end |
#cancelled? ⇒ Boolean
33 34 35 |
# File 'lib/rack/timeout/support/scheduler.rb', line 33 def cancelled? !!@cancelled end |
#run! ⇒ Object
37 38 39 40 |
# File 'lib/rack/timeout/support/scheduler.rb', line 37 def run! return if @cancelled proc.call(self) end |