Class: Pilfer::Profiler
- Inherits:
-
Object
- Object
- Pilfer::Profiler
- Defined in:
- lib/pilfer/profiler.rb
Instance Attribute Summary collapse
-
#reporter ⇒ Object
readonly
Returns the value of attribute reporter.
Instance Method Summary collapse
-
#initialize(reporter) ⇒ Profiler
constructor
A new instance of Profiler.
- #profile(*args, &app) ⇒ Object
- #profile_files_matching(matcher, description = nil, reporter_options = {}, profiler = method(:lineprof), start = Time.now, &app) ⇒ Object
Constructor Details
#initialize(reporter) ⇒ Profiler
Returns a new instance of Profiler.
7 8 9 |
# File 'lib/pilfer/profiler.rb', line 7 def initialize(reporter) @reporter = reporter end |
Instance Attribute Details
#reporter ⇒ Object (readonly)
Returns the value of attribute reporter.
5 6 7 |
# File 'lib/pilfer/profiler.rb', line 5 def reporter @reporter end |
Instance Method Details
#profile(*args, &app) ⇒ Object
11 12 13 |
# 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) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pilfer/profiler.rb', line 15 def profile_files_matching(matcher, description = nil, = {}, 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, app_response end |