From 4c274827d2de59843bace612588425a65a2d5b73 Mon Sep 17 00:00:00 2001 From: Hatlen Date: Sun, 27 Jul 2014 12:58:54 +0200 Subject: [PATCH] Refactored to method level rescue [method level rescue](http://seejohncode.com/2012/04/17/short-tip-rescuing-a-method-in-ruby/) --- lib/asset_sync/config.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/asset_sync/config.rb b/lib/asset_sync/config.rb index 018588ed..00f93439 100644 --- a/lib/asset_sync/config.rb +++ b/lib/asset_sync/config.rb @@ -110,11 +110,9 @@ def yml_exists? end def yml - begin - @yml ||= YAML.load(ERB.new(IO.read(yml_path)).result)[Rails.env] || {} - rescue Psych::SyntaxError - @yml = {} - end + @yml ||= YAML.load(ERB.new(IO.read(yml_path)).result)[Rails.env] || {} + rescue Psych::SyntaxError + @yml = {} end def yml_path