Sha256: 665a803bf0a98923579186209f96ba09305f77b50ba31afa109ed74ff2589aab

Contents?: true

Size: 1009 Bytes

Versions: 5

Compression:

Stored size: 1009 Bytes

Contents

require 'qujo/queue/resque/job_worker'
require 'qujo/queue/resque/schedule_worker'

module Qujo
  module Queue
    module Resque
      extend ActiveSupport::Concern

      included do
        def enqueue
          raise Qujo::Exceptions::ResqueNotLoaded unless defined?(::Resque)
          ::Resque.enqueue(Qujo::Queue::Resque::JobWorker, {id: self.id.to_s})
        end

        def enqueue_in(seconds)
          raise Qujo::Exceptions::ResqueNotLoaded unless defined?(::Resque)
          raise Qujo::Exceptions::ResqueSchedulerNotLoaded unless defined?(::Resque::Scheduler)
          ::Resque.enqueue_in(seconds, Qujo::Queue::Resque::JobWorker, {id: self.id.to_s})
        end

        def enqueue_at(time)
          raise Qujo::Exceptions::ResqueNotLoaded unless defined?(::Resque)
          raise Qujo::Exceptions::ResqueSchedulerNotLoaded unless defined?(::Resque::Scheduler)
          ::Resque.enqueue_at(time, Qujo::Queue::Resque::JobWorker, {id: self.id.to_s})
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qujo-0.1.4 lib/qujo/queue/resque.rb
qujo-0.1.3 lib/qujo/queue/resque.rb
qujo-0.1.2 lib/qujo/queue/resque.rb
qujo-0.1.1 lib/qujo/queue/resque.rb
qujo-0.1.0 lib/qujo/queue/resque.rb