From a1d449e061d163fc0f6cb8c966d9ebf70923b665 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 6 Dec 2018 13:27:45 -0800 Subject: Add a :all catch-all route --- lib/action_mailbox/router/route.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/action_mailbox') diff --git a/lib/action_mailbox/router/route.rb b/lib/action_mailbox/router/route.rb index 24be8d4804..5254043a67 100644 --- a/lib/action_mailbox/router/route.rb +++ b/lib/action_mailbox/router/route.rb @@ -9,6 +9,8 @@ class ActionMailbox::Router::Route def match?(inbound_email) case address + when :all + true when String inbound_email.mail.recipients.any? { |recipient| address.casecmp?(recipient) } when Regexp @@ -26,8 +28,8 @@ class ActionMailbox::Router::Route private def ensure_valid_address - unless [ String, Regexp, Proc ].any? { |klass| address.is_a?(klass) } || address.respond_to?(:match?) - raise ArgumentError, "Expected a String, Regexp, Proc, or matchable, got #{address.inspect}" + unless [ Symbol, String, Regexp, Proc ].any? { |klass| address.is_a?(klass) } || address.respond_to?(:match?) + raise ArgumentError, "Expected a Symbol, String, Regexp, Proc, or matchable, got #{address.inspect}" end end end -- cgit v1.2.3