class UV::OneShot
Public Class Methods
new(scheduler, at)
click to toggle source
Calls superclass method
UV::ScheduledEvent::new
# File lib/uv-rays/scheduler.rb, line 74 def initialize(scheduler, at) super(scheduler) @next_scheduled = at end
Public Instance Methods
trigger()
click to toggle source
Runs the event and cancels the schedule
Calls superclass method
UV::ScheduledEvent#trigger
# File lib/uv-rays/scheduler.rb, line 97 def trigger super() @defer.resolve(:triggered) end
update(time)
click to toggle source
Updates the scheduled time
# File lib/uv-rays/scheduler.rb, line 81 def update(time) @last_scheduled = @reactor.now parsed_time = Scheduler.parse_in(time, :quiet) if parsed_time.nil? # Parse at will throw an error if time is invalid parsed_time = Scheduler.parse_at(time) - @scheduler.time_diff else parsed_time += @last_scheduled end @next_scheduled = parsed_time @scheduler.reschedule(self) end