Module: Que::Mailer::ClassMethods

Defined in:
lib/que_mailer.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/que_mailer.rb', line 23

def method_missing(method_name, *args)
  if action_methods.include?(method_name.to_s)
    MessageDecoy.new(self, method_name, *args)
  else
    super
  end
end

Instance Method Details

#current_envObject



15
16
17
18
19
20
21
# File 'lib/que_mailer.rb', line 15

def current_env
  if defined?(Rails)
    ::Que::Mailer.current_env || ::Rails.env
  else
    ::Que::Mailer.current_env
  end
end

#deliver?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/que_mailer.rb', line 45

def deliver?
  true
end

#perform(action, *args) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/que_mailer.rb', line 31

def perform(action, *args)
  begin
    message = self.send(:new, action, *args).message
    message.deliver
  rescue Exception => ex
    if logger
      logger.error "Unable to deliver email [#{action}]: #{ex}"
      logger.error ex.backtrace.join("\n\t")
    end
  end
    
  raise ex
end