Action Mailbox 路由器
封装 ApplicationMailbox 上的路由,并在收到 inbound_email 时执行实际的路由。
命名空间
方法
- A
- M
- N
- R
类公共方法
new() 链接
来源: 显示 | 在 GitHub 上
# File actionmailbox/lib/action_mailbox/router.rb, line 11 def initialize @routes = [] end
实例公共方法
add_route(address, to:) 链接
来源: 显示 | 在 GitHub 上
# File actionmailbox/lib/action_mailbox/router.rb, line 21 def add_route(address, to:) routes.append Route.new(address, to: to) end
add_routes(routes) 链接
来源: 显示 | 在 GitHub 上
# File actionmailbox/lib/action_mailbox/router.rb, line 15 def add_routes(routes) routes.each do |(address, mailbox_name)| add_route address, to: mailbox_name end end
mailbox_for(inbound_email) 链接
来源: 显示 | 在 GitHub 上
# File actionmailbox/lib/action_mailbox/router.rb, line 35 def mailbox_for(inbound_email) routes.detect { |route| route.match?(inbound_email) }&.mailbox_class end
route(inbound_email) 链接
来源: 显示 | 在 GitHub 上
# File actionmailbox/lib/action_mailbox/router.rb, line 25 def route(inbound_email) if mailbox = mailbox_for(inbound_email) mailbox.receive(inbound_email) else inbound_email.bounced! raise RoutingError end end