diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object_and_class.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object_and_class.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/object_and_class.rb b/activesupport/lib/active_support/core_ext/object_and_class.rb index eb54f79534..be486b0816 100644 --- a/activesupport/lib/active_support/core_ext/object_and_class.rb +++ b/activesupport/lib/active_support/core_ext/object_and_class.rb @@ -21,6 +21,13 @@ class Object #:nodoc: !self end end + + def suppress(*exception_classes) + begin yield + rescue Exception => e + raise unless exception_classes.any? {|cls| e.kind_of? cls} + end + end end class Class #:nodoc: |