Skip to content

Commit

Permalink
make it possible to have the mailer class answer whether to deliver a…
Browse files Browse the repository at this point in the history
… message on a case-by-case basis
  • Loading branch information
jamesgolick authored and zapnap committed Nov 7, 2011
1 parent 09b3e97 commit 2a8a340
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/resque_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def resque
def excluded_environment?(name)
::Resque::Mailer.excluded_environments && ::Resque::Mailer.excluded_environments.include?(name.to_sym)
end

def deliver?
true
end
end

class MessageDecoy
Expand All @@ -69,7 +73,9 @@ def actual_message
end

def deliver
resque.enqueue(@mailer_class, @method_name, *@args)
if @mailer_class.deliver?
resque.enqueue(@mailer_class, @method_name, *@args)
end
end

def deliver!
Expand Down

0 comments on commit 2a8a340

Please sign in to comment.