Sha256: fdcc35746f3b9273764c0f1e3fc3bd82c07cc1d89a0f6c9cf62022d977b73cca

Contents?: true

Size: 594 Bytes

Versions: 3

Compression:

Stored size: 594 Bytes

Contents

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) # :nodoc:
        clock = Sidetiq::Clock.instance
        clock.synchronize do
          clock.schedule_for(self).instance_eval(&block)
        end
      end
    end

    def self.included(klass) # :nodoc:
      klass.extend(Sidetiq::Schedulable::ClassMethods)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sidetiq-0.1.5 lib/sidetiq/schedulable.rb
sidetiq-0.1.4 lib/sidetiq/schedulable.rb
sidetiq-0.1.3 lib/sidetiq/schedulable.rb