class Pilfer::Profiler

Attributes

reporter[R]

Public Class Methods

new(reporter) click to toggle source
# File lib/pilfer/profiler.rb, line 7
def initialize(reporter)
  @reporter = reporter
end

Public Instance Methods

profile(*args, &app) click to toggle source
# File lib/pilfer/profiler.rb, line 11
def profile(*args, &app)
  profile_files_matching(/./, *args, &app)
end
profile_files_matching(matcher, description = nil, reporter_options = {}, profiler = method(:lineprof), start = Time.now, &app) click to toggle source
# File lib/pilfer/profiler.rb, line 15
def profile_files_matching(matcher, description = nil,
                           reporter_options = {},
                           profiler = method(:lineprof),
                           start = Time.now, &app)
  app_response = nil
  profile = profiler.call(matcher) do
    app_response = app.call
  end
  reporter.write profile, start, description, reporter_options
  app_response
end