Sha256: 8f570d8d23370a83d673194712a975f04cf4282c2a9c27ad32ffa9579962ef3b

Contents?: true

Size: 843 Bytes

Versions: 12

Compression:

Stored size: 843 Bytes

Contents

require "forwardable"
module Queuel
  module IronMq
    class Engine < Base::Engine
      extend Forwardable
      def_delegators :Queuel, :logger

      IronMqMissingError = Class.new(StandardError)

      private

      def try_typhoeus
        require 'typhoeus'
        true
      rescue LoadError
        logger.warn "Typhoeus not found..."
        logger.warn "Typhoeus is recommended for IronMQ"
        false
      end

      def client_klass
        if defined?(::IronMQ::Client)
          try_typhoeus
          ::IronMQ::Client
        else
          begin
            logger.info "Loading IronMQ..."
            require 'iron_mq'
            ::IronMQ::Client
          rescue LoadError
            logger.error "Couldn't find iron_mq gem"
            raise(IronMqMissingError)
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
queuel-0.4.8 lib/queuel/iron_mq/engine.rb
queuel-0.4.6 lib/queuel/iron_mq/engine.rb
queuel-0.4.5 lib/queuel/iron_mq/engine.rb
queuel-0.4.4 lib/queuel/iron_mq/engine.rb
queuel-0.4.3 lib/queuel/iron_mq/engine.rb
queuel-0.4.2 lib/queuel/iron_mq/engine.rb
queuel-0.4.1 lib/queuel/iron_mq/engine.rb
queuel-0.4.0 lib/queuel/iron_mq/engine.rb
queuel-0.3.1 lib/queuel/iron_mq/engine.rb
queuel-0.3.0 lib/queuel/iron_mq/engine.rb
queuel-0.2.0 lib/queuel/iron_mq/engine.rb
queuel-0.1.0 lib/queuel/iron_mq/engine.rb