mirror of
https://github.com/endofunky/sidetiq.git
synced 2022-11-09 13:53:30 -05:00
Add documention for Sidetiq::Schedulable.
This commit is contained in:
parent
877a12a7dd
commit
155ee50bc5
1 changed files with 13 additions and 2 deletions
|
@ -1,7 +1,18 @@
|
|||
module Sidetiq
|
||||
# Public: Mixin for Sidekiq::Worker classes.
|
||||
#
|
||||
# Examples
|
||||
#
|
||||
# class MyWorker
|
||||
# include Sidekiq::Worker
|
||||
# include Sidetiq::Schedulable
|
||||
#
|
||||
# # Daily at midnight
|
||||
# tiq { daily }
|
||||
# end
|
||||
module Schedulable
|
||||
module ClassMethods
|
||||
def tiq(&block)
|
||||
def tiq(&block) # :nodoc:
|
||||
clock = Sidetiq::Clock.instance
|
||||
clock.synchronize do
|
||||
clock.schedule_for(self).instance_eval(&block)
|
||||
|
@ -9,7 +20,7 @@ module Sidetiq
|
|||
end
|
||||
end
|
||||
|
||||
def self.included(klass)
|
||||
def self.included(klass) # :nodoc:
|
||||
klass.extend(Sidetiq::Schedulable::ClassMethods)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue