Module: Resque::Mailer::ClassMethods
- Defined in:
- lib/resque_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
44
45
46
47
48
49
50
|
# File 'lib/resque_mailer.rb', line 44
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
#deliver? ⇒ Boolean
97
98
99
|
# File 'lib/resque_mailer.rb', line 97
def deliver?
true
end
|
#excluded_environment?(name) ⇒ Boolean
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/resque_mailer.rb', line 52
def perform(action, serialized_args)
begin
args = ::Resque::Mailer.argument_serializer.deserialize(serialized_args)
if args.is_a?(Array)
args = args.each_with_object([]) do |arg, o|
o << (arg.is_a?(Hash) ? arg.with_indifferent_access : arg)
end
end
message = ::Resque::Mailer.prepare_message(self, action, *args)
if message.respond_to?(:deliver_now)
message.deliver_now
else
message.deliver
end
rescue Exception => ex
if Mailer.error_handler
Mailer.error_handler.call(self, message, ex, action, args)
else
if logger
logger.error "Unable to deliver email [#{action}]: #{ex}"
logger.error ex.backtrace.join("\n\t")
end
raise ex
end
end
end
|
#queue=(name) ⇒ Object
85
86
87
|
# File 'lib/resque_mailer.rb', line 85
def queue=(name)
@queue = name
end
|