Class: CableRoom::PeriodicTimer

Inherits:
Object
  • Object
show all
Defined in:
lib/cable_room/channel_base.rb

Overview

ActionCable's stop_periodic_timers calls #shutdown on whatever #start_periodic_timer returned, but Rufus jobs are cancelled with #unschedule. Adapt the one to the other here rather than aliasing #shutdown onto Rufus::Scheduler::Job for the whole process.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ PeriodicTimer

Returns a new instance of PeriodicTimer.



225
226
227
# File 'lib/cable_room/channel_base.rb', line 225

def initialize(job)
  @job = job
end

Instance Attribute Details

#jobObject (readonly)

Returns the value of attribute job.



221
222
223
# File 'lib/cable_room/channel_base.rb', line 221

def job
  @job
end

Instance Method Details

#shutdownObject



229
230
231
# File 'lib/cable_room/channel_base.rb', line 229

def shutdown
  job.unschedule
end