class Steep::Drivers::Stats::CSVPrinter
def initialize(io:)
def initialize(io:) @io = io end
def print(stats_result)
def print(stats_result) io.puts( CSV.generate do |csv| csv << ["Target", "File", "Status", "Typed calls", "Untyped calls", "All calls", "Typed %"] stats_result.each do |row| if row[:type] == "success" csv << [ row[:target], row[:path], row[:type], row[:typed_calls], row[:untyped_calls], row[:total_calls], if row[:total_calls].nonzero? (row[:typed_calls].to_f / row[:total_calls] * 100).to_i else 100 end ] else csv << [ row[:target], row[:path], row[:type], 0, 0, 0, 0 ] end end end ) end