Sha256: db1352e0ab484e66f1ca02d328e2c2b72591a9bd81017af53f3dbab6ba3e8154

Contents?: true

Size: 685 Bytes

Versions: 3

Compression:

Stored size: 685 Bytes

Contents

module BenchmarkDriver
  module Output
    require 'benchmark_driver/output/compare'
    require 'benchmark_driver/output/markdown'
    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

      ::BenchmarkDriver::Output.const_get(camelize(type), false)
    end

    private

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
benchmark_driver-0.9.2 lib/benchmark_driver/output.rb
benchmark_driver-0.9.1 lib/benchmark_driver/output.rb
benchmark_driver-0.9.0 lib/benchmark_driver/output.rb