Sha256: 923829b7eacff043a015bbc9c86e503113cef52b66370c118de1587d1fcb658e
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module Resque module Mailer def self.included(base) base.extend(ClassMethods) end module ClassMethods def method_missing(method_symbol, *params) if ::Resque::Mailer.excluded_environments && ::Resque::Mailer.excluded_environments.include?(::RAILS_ENV.to_sym) return super(method_symbol, *params) end case method_symbol.id2name when /^deliver_([_a-z]\w*)\!/ then super(method_symbol, *params) when /^deliver_([_a-z]\w*)/ then ::Resque.enqueue(self, "#{method_symbol}!", *params) else super(method_symbol, *params) end end def queue :mailer end def perform(cmd, *args) send(cmd, *args) end end def self.excluded_environments=(*environments) @@excluded_environments = environments && environments.flatten.collect! { |env| env.to_sym } end def self.excluded_environments @@excluded_environments ||= [] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
resque_mailer-0.2.1 | lib/resque_mailer.rb |
resque_mailer-0.2.0 | lib/resque_mailer.rb |