Sha256: d7cbb3532ff37c93e9ae8e2b17c8e4a1b916a08da95d8056208ace13cd32aa24

Contents?: true

Size: 588 Bytes

Versions: 4

Compression:

Stored size: 588 Bytes

Contents

require 'rblineprof'

module Pilfer
  class Profiler
    attr_reader :reporter

    def initialize(reporter)
      @reporter = reporter
    end

    def profile(profiler = method(:lineprof), start = Time.now, &app)
      profile_files_matching(/./, profiler, start, &app)
    end

    def profile_files_matching(matcher, profiler = method(:lineprof),
                               start = Time.now, &app)
      app_response = nil
      profile = profiler.call(matcher) do
        app_response = app.call
      end
      reporter.write profile, start
      app_response
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pilfer-0.0.1.pre4 lib/pilfer/profiler.rb
pilfer-0.0.1.pre3 lib/pilfer/profiler.rb
pilfer-0.0.1.pre2 lib/pilfer/profiler.rb
pilfer-0.0.1.pre lib/pilfer/profiler.rb