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

19 lines
358 B
Ruby
Raw Normal View History

2018-09-18 01:15:27 -04:00
require "byebug"
2018-09-17 20:49:47 -04:00
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)
2018-09-18 01:15:27 -04:00
"#{routes[inbound_email.mail.to.first].to_s.capitalize}Mailbox".constantize
2018-09-17 20:49:47 -04:00
end
end