Module: HasEmails::Extensions::ActionMailer::ClassMethods

Defined in:
lib/has_emails/extensions/action_mailer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

:nodoc:


34
35
36
37
38
# File 'lib/has_emails/extensions/action_mailer.rb', line 34

def self.extended(base) #:nodoc:
  class << base
    alias_method_chain :method_missing, :has_emails
  end
end

Instance Method Details

#method_missing_with_has_emails(method_symbol, *parameters) ⇒ Object

Handles calls to queue_*


41
42
43
44
45
46
47
48
49
50
# File 'lib/has_emails/extensions/action_mailer.rb', line 41

def method_missing_with_has_emails(method_symbol, *parameters)
  case method_symbol.id2name
    when /^queue_([_a-z]\w*)/      # Queues the mail so that it's processed in the background

      new($1, *parameters).queue
    else
      # Handle the mail delivery as normal
      method_missing_without_has_emails(method_symbol, *parameters)
  end
end