1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/lib/action_mailroom/router.rb
David Heinemeier Hansson ee6d9545dd Included in test helper now
2018-09-19 15:33:53 -07:00

16 lines
340 B
Ruby

class ActionMailroom::Router
def initialize(routes)
@routes = routes
end
def route(inbound_email)
locate_mailbox(inbound_email).receive(inbound_email)
end
private
attr_reader :routes
def locate_mailbox(inbound_email)
"#{routes[inbound_email.mail.to.first].to_s.capitalize}Mailbox".constantize
end
end