From dd96e8e3337c04c5c37ece7983d012a9353804ac Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Tue, 9 Dec 2014 12:04:50 +0200 Subject: Add class level case operator support for error dispatching in Rescuable --- activesupport/lib/active_support/rescuable.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/rescuable.rb b/activesupport/lib/active_support/rescuable.rb index a7eba91ac5..1a02acd5b1 100644 --- a/activesupport/lib/active_support/rescuable.rb +++ b/activesupport/lib/active_support/rescuable.rb @@ -60,7 +60,7 @@ module ActiveSupport end klasses.each do |klass| - key = if klass.is_a?(Class) && klass <= Exception + key = if klass.is_a?(Module) && klass.respond_to?(:===) klass.name elsif klass.is_a?(String) klass @@ -101,7 +101,7 @@ module ActiveSupport # itself when rescue_from CONSTANT is executed. klass = self.class.const_get(klass_name) rescue nil klass ||= klass_name.constantize rescue nil - exception.is_a?(klass) if klass + klass === exception if klass end case rescuer -- cgit v1.2.3