Skip to content

Commit

Permalink
Refactored to method level rescue
Browse files Browse the repository at this point in the history
  • Loading branch information
Hatlen committed Jul 27, 2014
1 parent ade187d commit 4c27482
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/asset_sync/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4c27482

Please sign in to comment.