diff options
author | George Claghorn <george@basecamp.com> | 2019-05-09 23:02:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-09 23:02:21 -0500 |
commit | 6394f9da6938d0dccfd8c95f10b2fb7ee98ab953 (patch) | |
tree | 366fc7d2a8c064f5c4987c4344d27ba5365a92e8 /actionmailbox/lib/action_mailbox/router.rb | |
parent | 3363a3c2a54ab1796f1a520538820271f977bc71 (diff) | |
parent | 937f7d582efc75bae336fbf1de4bd93476ab7f5e (diff) | |
download | rails-6394f9da6938d0dccfd8c95f10b2fb7ee98ab953.tar.gz rails-6394f9da6938d0dccfd8c95f10b2fb7ee98ab953.tar.bz2 rails-6394f9da6938d0dccfd8c95f10b2fb7ee98ab953.zip |
Merge pull request #36181 from jamesdabbs/jcd/action-mailbox-for
Expose `mailbox_for` method
Diffstat (limited to 'actionmailbox/lib/action_mailbox/router.rb')
-rw-r--r-- | actionmailbox/lib/action_mailbox/router.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionmailbox/lib/action_mailbox/router.rb b/actionmailbox/lib/action_mailbox/router.rb index 71370e409d..54982eae21 100644 --- a/actionmailbox/lib/action_mailbox/router.rb +++ b/actionmailbox/lib/action_mailbox/router.rb @@ -21,7 +21,7 @@ module ActionMailbox end def route(inbound_email) - if mailbox = match_to_mailbox(inbound_email) + if mailbox = mailbox_for(inbound_email) mailbox.receive(inbound_email) else inbound_email.bounced! @@ -30,12 +30,12 @@ module ActionMailbox end end + def mailbox_for(inbound_email) + routes.detect { |route| route.match?(inbound_email) }.try(:mailbox_class) + end + private attr_reader :routes - - def match_to_mailbox(inbound_email) - routes.detect { |route| route.match?(inbound_email) }.try(:mailbox_class) - end end end |