Sha256: 1ef256cd10d18d3c377ad525fa1caebed010e7ec0999a0a253dd6830b7bc2c92

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

module MultiWorker
  module Adapters
    class DelayedJob
      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)
            delay(:queue => @queue).perform(*args)
          end

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_worker-0.1.0 lib/multi_worker/adapters/delayed_job.rb