Class: Scheduler::Event
Overview
Represents an event which has been submitted to the scheduler (e.g. via Scheduler.at_time); the Event#cancel method may be used to cancel the event’s execution
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
:nodoc:.
-
#cancel ⇒ Object
Cancels the execution of the event represented by
self
if it has not already begun execution. -
#initialize(time, &proc) ⇒ Event
constructor
:nodoc:.
-
#run ⇒ Object
:nodoc:.
Constructor Details
#initialize(time, &proc) ⇒ Event
:nodoc:
24 25 26 27 |
# File 'lib/scheduler.rb', line 24 def initialize( time, &proc ) #:nodoc: @time = time @proc = proc end |
Instance Attribute Details
#time ⇒ Object (readonly)
:nodoc:
22 23 24 |
# File 'lib/scheduler.rb', line 22 def time @time end |
Instance Method Details
#<=>(other) ⇒ Object
:nodoc:
44 45 46 |
# File 'lib/scheduler.rb', line 44 def <=>( other ) #:nodoc: @time <=> other.time end |
#cancel ⇒ Object
Cancels the execution of the event represented by self
if it has not already begun execution
39 40 41 42 |
# File 'lib/scheduler.rb', line 39 def cancel Scheduler.cancel self self end |
#run ⇒ Object
:nodoc:
29 30 31 32 33 34 35 |
# File 'lib/scheduler.rb', line 29 def run #:nodoc: begin @proc.call rescue Exception end self end |