Sha256: 77a874d0ecf692a8cf57457dcfdc528eb1487e52cf7091486be9db7a7f759ae9

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 Bytes

Contents

module MultiWorker
  module Adapters
    class Qu
      def self.configure(base, opts={})
        base.class_eval do
          @queue = opts[:queue]

          def self.perform(*args)
            self.new.perform(*args)
          end

          def self.perform_async(*args)
            ::Qu.enqueue(self, *args)
          end

          def perform_async(*args)
            self.class.perform_async(*args)
          end
        end
      end

      def self.rake_task
        require 'rake'
        require 'qu/tasks'

        ::Rake::Task['qu:work']
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
multi_worker-0.2.0 lib/multi_worker/adapters/qu.rb
multi_worker-0.1.0 lib/multi_worker/adapters/qu.rb