Sha256: 07c76a92e73ccdbfad9ec560682650ee6c03c4c2d3a1017fa49c462827d181d7

Contents?: true

Size: 468 Bytes

Versions: 6

Compression:

Stored size: 468 Bytes

Contents

module Rake::Funnel::Tasks::TimingSupport
  class Statistics
    include Enumerable

    attr_reader :started_at

    def initialize
      @stats = []
      @started_at = Time.now
    end

    def each(&block)
      @stats.each(&block)
    end

    def benchmark(task)
      t0 = Time.now
      begin
        yield if block_given?
      ensure
        t1 = Time.now
        @stats << { task: task, time: t1 - t0 }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rake-funnel-0.0.6.pre lib/rake/funnel/tasks/timing_support/statistics.rb
rake-funnel-0.0.5.pre lib/rake/funnel/tasks/timing_support/statistics.rb
rake-funnel-0.0.4.pre lib/rake/funnel/tasks/timing_support/statistics.rb
rake-funnel-0.0.3.pre lib/rake/funnel/tasks/timing_support/statistics.rb
rake-funnel-0.0.2.pre lib/rake/funnel/tasks/timing_support/statistics.rb
rake-funnel-0.0.1.pre lib/rake/funnel/tasks/timing_support/statistics.rb