Sha256: 7313353b025bde719f18a60d5d79d654d57f53503218f49e75050a64981ba39e

Contents?: true

Size: 791 Bytes

Versions: 5

Compression:

Stored size: 791 Bytes

Contents

module BenchmarkDriver
  module Output
    require 'benchmark_driver/output/compare'
    require 'benchmark_driver/output/markdown'
    require 'benchmark_driver/output/record'
    require 'benchmark_driver/output/simple'
  end

  class << Output
    # BenchmarkDriver::Output is pluggable.
    # Create `BenchmarkDriver::Output::Foo` as benchmark_dirver-output-foo.gem and specify `-o foo`.
    #
    # @param [String] type
    def find(type)
      if type.include?(':')
        raise ArgumentError.new("Output type '#{type}' cannot contain ':'")
      end

      require "benchmark_driver/output/#{type}" # for plugin
      ::BenchmarkDriver::Output.const_get(camelize(type), false)
    end

    private

    def camelize(str)
      str.split('_').map(&:capitalize).join
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
benchmark_driver-0.10.16 lib/benchmark_driver/output.rb
benchmark_driver-0.10.15 lib/benchmark_driver/output.rb
benchmark_driver-0.10.14 lib/benchmark_driver/output.rb
benchmark_driver-0.10.13 lib/benchmark_driver/output.rb
benchmark_driver-0.10.12 lib/benchmark_driver/output.rb