Sha256: 603b768be48bd7513b61f52898308728d86d19929908386452b199809c20d750

Contents?: true

Size: 463 Bytes

Versions: 5

Compression:

Stored size: 463 Bytes

Contents

module Rake::Funnel::Support::Timing
  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

5 entries across 5 versions & 1 rubygems

Version Path
rake-funnel-0.3.2.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.3.1.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.3.0.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.2.0.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.1.0.pre lib/rake/funnel/support/timing/statistics.rb