aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorGenadi Samokovarov <gsamokovarov@gmail.com>2014-12-09 12:04:50 +0200
committerGenadi Samokovarov <gsamokovarov@gmail.com>2014-12-10 02:34:59 +0200
commitdd96e8e3337c04c5c37ece7983d012a9353804ac (patch)
tree59f81c0ad939b9922f724815565be0a566ad3e1a /activesupport/lib/active_support
parent6f4fd2c6322342a4189a2a5ebb50a7650c07ae88 (diff)
downloadrails-dd96e8e3337c04c5c37ece7983d012a9353804ac.tar.gz
rails-dd96e8e3337c04c5c37ece7983d012a9353804ac.tar.bz2
rails-dd96e8e3337c04c5c37ece7983d012a9353804ac.zip
Add class level case operator support for error dispatching in Rescuable
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/rescuable.rb4
1 files changed, 2 insertions, 2 deletions
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