Sha256: 26b9f39d50be5ab17176453f612434425a2663c7caaa4ca7fabf89471706bb0d

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

module Benchmark
  module Plot
    class ReportMaker
      def initialize data
        @data = data
        @reports = {}
      end

      def report(label,&block)
        results_array = @data.each_with_object([]) do |d, results|
          lmb = lambda { block.call(d) }
          results << Benchmark.measure(label, &lmb)
        end
        @reports[label] = results_array
      end

      # An array of Benchmark::Tms objects representing each item.
      attr_reader :reports
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
benchmark-plot-0.1.1 lib/benchmark/plot/report_maker.rb
benchmark-plot-0.1 lib/benchmark/plot/report_maker.rb