Sha256: 094db7633375741e44f80ebd9877125c16e47f873a74472c3f07c2fb93184b37

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require "active_support/dependencies"
require "devise/async/version"

module Devise
  module Async
    autoload :Proxy,   "devise/async/proxy"
    autoload :Worker,  "devise/async/worker"
    autoload :Backend, "devise/async/backend"
    autoload :Model,   "devise/async/model"

    module Backend
      autoload :Base,         "devise/async/backend/base"
      autoload :Resque,       "devise/async/backend/resque"
      autoload :Sidekiq,      "devise/async/backend/sidekiq"
      autoload :DelayedJob,   "devise/async/backend/delayed_job"
      autoload :QueueClassic, "devise/async/backend/queue_classic"
    end

    # Defines the queue backend to be used. Resque by default.
    mattr_accessor :backend
    @@backend = :resque

    # Defines the mailer class to be used. Devise::Mailer by default.
    mattr_accessor :mailer
    @@mailer = "Devise::Mailer"

    # Defines the queue in which the background job will be enqueued. Default is :mailer.
    mattr_accessor :queue
    @@queue = :mailer

    # Allow configuring Devise::Async with a block
    #
    # Example:
    #
    #     Devise::Async.setup do |config|
    #       config.backend = :resque
    #       config.mailer  = "MyMailer"
    #       config.queue   = :my_custom_queue
    #     end
    def self.setup
      yield self
    end
  end
end

# Register devise-async model in Devise
Devise.add_module(:async, :model => 'devise/async/model')

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise-async-0.5.1 lib/devise/async.rb
devise-async-0.5.0 lib/devise/async.rb