Skip to content

Commit 2f2d40a

Browse files
committed
Simplify the write_json method
1 parent 6d4478b commit 2f2d40a

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/benchmark_runner.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@ def output_path(out_path_dir, out_override: nil)
2020

2121
# Write benchmark data to JSON file
2222
def write_json(output_path, ruby_descriptions, bench_data)
23-
out_json_path = output_path + ".json"
24-
File.open(out_json_path, "w") do |file|
25-
out_data = {
26-
metadata: ruby_descriptions,
27-
raw_data: bench_data,
28-
}
29-
json_str = JSON.generate(out_data)
30-
file.write json_str
31-
end
23+
out_json_path = "#{output_path}.json"
24+
out_data = {
25+
metadata: ruby_descriptions,
26+
raw_data: bench_data,
27+
}
28+
File.write(out_json_path, JSON.generate(out_data))
3229
out_json_path
3330
end
3431

0 commit comments

Comments
 (0)