diff options
author | Zachary Scott <zachary@zacharyscott.net> | 2013-05-15 00:19:38 -0400 |
---|---|---|
committer | Zachary Scott <zachary@zacharyscott.net> | 2013-05-15 00:19:38 -0400 |
commit | 41c3670fab23f3eb1acbd415d47cbf36dbc36bca (patch) | |
tree | 4cdc5ee1b086a023d5709d4512182ae9f8dac541 /actionmailer/lib/action_mailer | |
parent | e47c85c696de1c4137c222bedc846b2cdbb0893f (diff) | |
download | rails-41c3670fab23f3eb1acbd415d47cbf36dbc36bca.tar.gz rails-41c3670fab23f3eb1acbd415d47cbf36dbc36bca.tar.bz2 rails-41c3670fab23f3eb1acbd415d47cbf36dbc36bca.zip |
Document ActionMailer::LogSubscriber and ActionMailer::DeliveryMethods::ClassMethods
Diffstat (limited to 'actionmailer/lib/action_mailer')
-rw-r--r-- | actionmailer/lib/action_mailer/delivery_methods.rb | 1 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/log_subscriber.rb | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index caea3d7535..9a1a27c8ed 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -38,6 +38,7 @@ module ActionMailer add_delivery_method :test, Mail::TestMailer end + # Helpers for creating and wrapping delivery behavior, used by DeliveryMethods. module ClassMethods # Provides a list of emails that have been delivered by Mail::TestMailer delegate :deliveries, :deliveries=, to: Mail::TestMailer diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb index 3fe64759ac..c108156792 100644 --- a/actionmailer/lib/action_mailer/log_subscriber.rb +++ b/actionmailer/lib/action_mailer/log_subscriber.rb @@ -1,5 +1,8 @@ module ActionMailer + # Implements the ActiveSupport::LogSubscriber for logging notifications when + # email is delivered and received. class LogSubscriber < ActiveSupport::LogSubscriber + # An email was delivered. def deliver(event) return unless logger.info? recipients = Array(event.payload[:to]).join(', ') @@ -7,12 +10,14 @@ module ActionMailer debug(event.payload[:mail]) end + # An email was received. def receive(event) return unless logger.info? info("\nReceived mail (#{event.duration.round(1)}ms)") debug(event.payload[:mail]) end + # Use the logger configured for ActionMailer::Base def logger ActionMailer::Base.logger end |