Module: Pony

Defined in:
lib/postmortem/plugins/pony.rb

Overview

Pony monkey-patch.

Class Method Summary collapse

Class Method Details

._original_mailObject



6
# File 'lib/postmortem/plugins/pony.rb', line 6

alias _original_mail mail

.mail(options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/postmortem/plugins/pony.rb', line 8

def mail(options)
  strategy = options[:via].to_s
  # Pony uses the Mail gem for smtp delivery so we catch these further down the stack to
  # avoid duplicating deliveries.
  return _original_mail(options) if strategy == 'smtp'

  # When delivery method is "test" we do not want to interfere as ActionMailer.deliveries
  # (which delegates to Mail::TestMailer) is typically used in tests.
  result = _original_mail(options) if strategy == 'test' || !Postmortem.config.mail_skip_delivery
  Postmortem.record_delivery(Postmortem::Adapters::Pony.new(options))
  result
end