Sha256: 7c79f0df3937da1336e988462ac14b8bbfa8d32b1d3d41de831a39c04497fbc5

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

# frozen_string_literal: true

require "whysoslow"
require "scmd"

class ScmdBenchRunner
  attr_reader :result

  def self.run(*args)
    new(*args).run
  end

  def initialize(printer_io, cmd, num_times = 10)
    @cmd = cmd
    @proc = proc do
      num_times.times{ cmd.run! }
    end

    @printer =
      Whysoslow::DefaultPrinter.new(
        printer_io,
        title: "#{@cmd.cmd_str}: #{num_times} times",
        verbose: true,
      )
    @runner = Whysoslow::Runner.new(@printer)
  end

  def run
    @runner.run(&@proc)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scmd-3.0.4 bench/runner.rb