diff options
author | Akira Matsuda <ronnie@dio.jp> | 2013-01-05 14:45:18 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2013-01-06 15:41:14 +0900 |
commit | 70ae89c321444eef42c0c011b522f926250e7acd (patch) | |
tree | 0f7abe41af87a17deb5c90465d1e9a190e4a70a9 /actionpack/lib | |
parent | 3e8134a750bee5c4f7ede67f33263d36e4ff1474 (diff) | |
download | rails-70ae89c321444eef42c0c011b522f926250e7acd.tar.gz rails-70ae89c321444eef42c0c011b522f926250e7acd.tar.bz2 rails-70ae89c321444eef42c0c011b522f926250e7acd.zip |
Remove unnecessary begin..rescue..end, use only rescue
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions/routing.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/debug_helper.rb | 14 |
2 files changed, 9 insertions, 13 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb index 79dff7d121..abdab026d7 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb @@ -208,11 +208,9 @@ module ActionDispatch end def fail_on(exception_class) - begin - yield - rescue exception_class => e - raise MiniTest::Assertion, e.message - end + yield + rescue exception_class => e + raise MiniTest::Assertion, e.message end end end diff --git a/actionpack/lib/action_view/helpers/debug_helper.rb b/actionpack/lib/action_view/helpers/debug_helper.rb index d361a69a92..34fc23ac1a 100644 --- a/actionpack/lib/action_view/helpers/debug_helper.rb +++ b/actionpack/lib/action_view/helpers/debug_helper.rb @@ -27,14 +27,12 @@ module ActionView # new_record: true # </pre> def debug(object) - begin - Marshal::dump(object) - object = ERB::Util.html_escape(object.to_yaml).gsub(" ", " ").html_safe - content_tag(:pre, object, :class => "debug_dump") - rescue Exception # errors from Marshal or YAML - # Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback - content_tag(:code, object.to_yaml, :class => "debug_dump") - end + Marshal::dump(object) + object = ERB::Util.html_escape(object.to_yaml).gsub(" ", " ").html_safe + content_tag(:pre, object, :class => "debug_dump") + rescue Exception # errors from Marshal or YAML + # Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback + content_tag(:code, object.to_yaml, :class => "debug_dump") end end end |