From 874446cd72f9edac60deb8dcd91cf2f019b5347c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 5 Nov 2018 16:36:21 -0800 Subject: Extract Mail-bound methods into mail_ext for future upstream work --- lib/action_mailbox/router/route.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib/action_mailbox/router') diff --git a/lib/action_mailbox/router/route.rb b/lib/action_mailbox/router/route.rb index 34cc684381..24be8d4804 100644 --- a/lib/action_mailbox/router/route.rb +++ b/lib/action_mailbox/router/route.rb @@ -10,9 +10,9 @@ class ActionMailbox::Router::Route def match?(inbound_email) case address when String - recipients_from(inbound_email.mail).any? { |recipient| address.casecmp?(recipient) } + inbound_email.mail.recipients.any? { |recipient| address.casecmp?(recipient) } when Regexp - recipients_from(inbound_email.mail).any? { |recipient| address.match?(recipient) } + inbound_email.mail.recipients.any? { |recipient| address.match?(recipient) } when Proc address.call(inbound_email) else @@ -30,8 +30,4 @@ class ActionMailbox::Router::Route raise ArgumentError, "Expected a String, Regexp, Proc, or matchable, got #{address.inspect}" end end - - def recipients_from(mail) - Array(mail.to) + Array(mail.cc) + Array(mail.bcc) - end end -- cgit v1.2.3