Sha256: 3b4a8e80171a62f91362a60a9b494fd8e1897d0e4bd102be3e4c10de3aff5067

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

module Resque
  module Mailer

    class << self
      attr_accessor :default_queue_name
      attr_reader :excluded_environments

      def excluded_environments=(envs)
        @excluded_environments = [*envs].map { |e| e.to_sym }
      end

      def included(base)
        base.extend(ClassMethods)
      end
    end

    self.default_queue_name = "mailer"
    self.excluded_environments = [:test]

    module ClassMethods
      def environment_excluded?
        excluded_environment?(current_env)
      end

      def queue
        ::Resque::Mailer.default_queue_name
      end

      def excluded_environment?(name)
        ::Resque::Mailer.excluded_environments && ::Resque::Mailer.excluded_environments.include?(name.to_sym)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resque_mailer-1.0.0 lib/resque_mailer/common.rb