From 0ff743fbd3dfb341f366d742e8c6001b3921f88c Mon Sep 17 00:00:00 2001 From: Robert Lail Date: Mon, 18 Mar 2013 19:24:32 -0500 Subject: [PATCH] only call .to_json once --- lib/simplecov-json.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/simplecov-json.rb b/lib/simplecov-json.rb index dd1e1f0..a89984e 100644 --- a/lib/simplecov-json.rb +++ b/lib/simplecov-json.rb @@ -23,11 +23,14 @@ class SimpleCov::Formatter::JSONFormatter total_lines: result.total_lines } + json = data.to_json + File.open(output_filepath, "w+") do |file| - file.puts data.to_json + file.puts json end puts output_message(result) - data.to_json + + json end def output_filename