Sha256: 86bacf4f5923f215dbd9f79c52fb5327fbfb0c77f3a1d8e23ec753313ba55d73

Contents?: true

Size: 611 Bytes

Versions: 28

Compression:

Stored size: 611 Bytes

Contents

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

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rake-funnel-0.9.1.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.9.0.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.8.0.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.7.0.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.6.1.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.6.0.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.5.0.pre lib/rake/funnel/support/timing/statistics.rb
rake-funnel-0.4.0.pre lib/rake/funnel/support/timing/statistics.rb