class Probatio::ProbaOutputter

def on_over(ev)

def on_over(ev)
TODO unplug if --mute or some switch like that...
  r = Probatio.recorder_plugin
  flh = r.failed_tests.collect(&:to_h).each { |h| h.delete(:n) }
  fls = Cerata.table_to_s(flh, '  ')
  rb = {}
    #
  rv =
    File.exist?('.ruby-version') &&
    File.readlines('.ruby-version').find { |l| ! l.strip.start_with?('#') }
    #
  rb[:v] = ".ruby-version:#{rv.strip}" if rv
  rb[:p] = File.join(
    RbConfig::CONFIG['bindir'],
    RbConfig::CONFIG['ruby_install_name'])
  rb[:d] = RUBY_DESCRIPTION
  rb[:l] = RUBY_PATCHLEVEL
    #
  #rb = Cerata.horizontal_h_to_s(rb)
  rb = Cerata.vertical_h_to_s(rb, '  ')
  env = Cerata.vertical_h_to_s(
    ENV.filter { |k, _|
      k.match?(/^(RUBY_|GEM_|(HOME|PATH|USER|SHELL|PWD)$)/) },
    '  ')
  File.open(Probatio.opath, 'wb') do |o|
    o << '# ' << Probatio.opath << "\n"
    o << "{\n"
    o << "argv: " << Cerata.horizontal_a_to_s(ARGV) << ",\n"
    o << "failures:\n"
    #o << "  [\n"
    #fls.each { |fl| o << '  ' << fl << ",\n" }
    #o << "  ],\n"
    o << fls << ",\n"
    o << "duration: #{Probatio.to_time_s(r.total_duration).inspect},\n"
    o << "probatio: { v: #{Probatio::VERSION.inspect} },\n"
    o << "ruby:\n#{rb},\n"
    o << "some_env:\n#{env},\n"
    o << "}\n"
  end
end