Class: Trashed::Rack
- Inherits:
-
Object
- Object
- Trashed::Rack
- Defined in:
- lib/trashed/rack.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, reporter, options = {}) ⇒ Rack
constructor
A new instance of Rack.
Constructor Details
#initialize(app, reporter, options = {}) ⇒ Rack
Returns a new instance of Rack.
7 8 9 10 11 |
# File 'lib/trashed/rack.rb', line 7 def initialize(app, reporter, = {}) @reporter = reporter @meters = Array(.fetch(:meters, [ResourceUsage])) @app = build_instrumented_app(app, @meters) end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/trashed/rack.rb', line 13 def call(env) env[STATE] = { :persistent => persistent_thread_state } env[TIMINGS] = {} env[GAUGES] = [] @app.call(env).tap { @reporter.report env } end |