module MandrillQueue

Constants

VERSION

Public Class Methods

adapter() click to toggle source
# File lib/mandrill_queue.rb, line 37
  def self.adapter
    @@lock.synchronize do
      @_adapter ||= begin
        unless adapter = configuration.adapter
          adapter = :resque if defined(::Resque)
          adapter = :sidekiq if defined(::Sidekiq)
          if adapter.nil?
            raise RuntimeError, <<-TXT.strip.tr("\t", '')
              Worker adapter was not configured and cannot be determined.
              Please include a worker gem in your Gemfile. Resque and Sidekiq are supported.
            TXT
          end
        end
        load_adapter(adapter)
      end
    end
  end
adapter=(adapter) click to toggle source
# File lib/mandrill_queue.rb, line 55
def self.adapter=(adapter)
  @_adapter = adapter.nil? ? nil : load_adapter(adapter)
end
configuration() click to toggle source
# File lib/mandrill_queue.rb, line 10
def self.configuration
        @configuration ||= Configuration.new(defaults)
end
configure() { |configuration| ... } click to toggle source
# File lib/mandrill_queue.rb, line 14
def self.configure
        yield configuration
        self
end
defaults() click to toggle source
# File lib/mandrill_queue.rb, line 19
  def self.defaults
          {
                  message_defaults: {},
adapter: :resque
          }
  end
eager_load!() click to toggle source
# File lib/mandrill_queue.rb, line 59
def self.eager_load!
  # No autoloads
end
load_adapter(adapter) click to toggle source
# File lib/mandrill_queue.rb, line 26
def self.load_adapter(adapter)
  if adapter.is_a?(Symbol)
    require "mandrill_queue/adapters/#{adapter}_adapter"
    "MandrillQueue::Adapters::#{adapter.to_s.camelize}Adapter".constantize.new
  elsif adapter.is_a?(String)
    adapter.constantize.new
  else
    adapter.try(:call) || adapter
  end
end
reset_config(&block) click to toggle source
# File lib/mandrill_queue.rb, line 63
    def self.reset_config(&block)
self.adapter = nil
            @configuration = nil
            configure(&block) if block_given?
    end