Sha256: 6279f073fced7ec37fc727d9ace3cf4232f80e6487b00ebd89e7213e552ceb35

Contents?: true

Size: 613 Bytes

Versions: 4

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

module Minitest
  class StatsReporter < AbstractReporter
    def initialize(_options)
      @results = []
    end

    def start
      @current_time = Time.now
    end

    def record(result)
      @results << result
    end

    def report
      slowest = @results.sort_by(&:time).reverse.first(10)
      slowest.each do |result|
        puts format("%<time>10.4f %<location>s",
                    time: result.time,
                    location: result.location)
      end
    end
  end

  def self.plugin_stats_init(options)
    reporter << StatsReporter.new(options)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gir_ffi-0.15.3 test/minitest/stats_plugin.rb
gir_ffi-0.15.2 test/minitest/stats_plugin.rb
gir_ffi-0.15.1 test/minitest/stats_plugin.rb
gir_ffi-0.15.0 test/minitest/stats_plugin.rb