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.



240
241
242
# File 'lib/cable_room/channel_base.rb', line 240

def initialize(job)
  @job = job
end

Instance Attribute Details

#job ⇒ Object (readonly)

Returns the value of attribute job.



236
237
238
# File 'lib/cable_room/channel_base.rb', line 236

def job
  @job
end

Instance Method Details

#shutdown ⇒ Object



244
245
246
# File 'lib/cable_room/channel_base.rb', line 244

def shutdown
  job.unschedule
end