Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #6902 from frodsan/mailer_async_doc

fix ActionMailer::Async docs and update to follow coding conventions
  • Loading branch information...
commit 809bdf342638592b0dfd2f888c7c9a4ac093d8cf 2 parents b64488d + e2abd8d
@carlosantoniodasilva carlosantoniodasilva authored
View
58 actionmailer/lib/action_mailer/async.rb
@@ -1,39 +1,41 @@
require 'delegate'
-module ActionMailer::Async
- def method_missing(method_name, *args)
- if action_methods.include?(method_name.to_s)
- QueuedMessage.new(queue, self, method_name, *args)
- else
- super
+module ActionMailer
+ module Async
+ def method_missing(method_name, *args)
+ if action_methods.include?(method_name.to_s)
+ QueuedMessage.new(queue, self, method_name, *args)
+ else
+ super
+ end
end
- end
- def queue
- Rails.queue
- end
+ def queue
+ Rails.queue
+ end
- class QueuedMessage < ::Delegator
- attr_reader :queue
+ class QueuedMessage < ::Delegator
+ attr_reader :queue
- def initialize(queue, mailer_class, method_name, *args)
- @queue = queue
- @mailer_class = mailer_class
- @method_name = method_name
- @args = args
- end
+ def initialize(queue, mailer_class, method_name, *args)
+ @queue = queue
+ @mailer_class = mailer_class
+ @method_name = method_name
+ @args = args
+ end
- def __getobj__
- @actual_message ||= @mailer_class.send(:new, @method_name, *@args).message
- end
+ def __getobj__
+ @actual_message ||= @mailer_class.send(:new, @method_name, *@args).message
+ end
- def run
- __getobj__.deliver
- end
+ def run
+ __getobj__.deliver
+ end
- # Will push the message onto the Queue to be processed
- def deliver
- @queue << self
+ # Will push the message onto the Queue to be processed
+ def deliver
+ @queue << self
+ end
end
end
-end
+end
View
6 actionmailer/lib/action_mailer/base.rb
@@ -457,10 +457,11 @@ def respond_to?(method, include_private = false) #:nodoc:
end
# Will force ActionMailer to push new messages to the queue defined
- # in the ActionMailer class when set to true
+ # in the ActionMailer class when set to true.
#
# class WelcomeMailer < ActionMailer::Base
# self.async = true
+ # end
def async=(truth)
if truth
require 'action_mailer/async'
@@ -785,5 +786,4 @@ def insert_part(container, response, charset) #:nodoc:
ActiveSupport.run_load_hooks(:action_mailer, self)
end
-end
-
+end
Please sign in to comment.
Something went wrong with that request. Please try again.