1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionmailbox/lib/action_mailbox/routing.rb
James Dabbs 9f96d094a3 Expose mailbox_for method
Currently, the only exposed entry point into the ApplicationMailbox's configured
routing system is to call `route`, which performs a lot of work to fully
`process` inbound email. It'd be nice to have a way (e.g. in test) of checking
which mailbox an email would route to without necessarily processing it yet.
2019-05-04 10:53:08 -07:00

26 lines
523 B
Ruby

# frozen_string_literal: true
module ActionMailbox
# See +ActionMailbox::Base+ for how to specify routing.
module Routing
extend ActiveSupport::Concern
included do
cattr_accessor :router, default: ActionMailbox::Router.new
end
class_methods do
def routing(routes)
router.add_routes(routes)
end
def route(inbound_email)
router.route(inbound_email)
end
def mailbox_for(inbound_email)
router.route(inbound_email)
end
end
end
end