class GCStats::Middleware

Rack middleware that clears out GC::Profiler's data on each request.

Public Class Methods

new(app) click to toggle source
# File lib/gc_stats/middleware.rb, line 6
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/gc_stats/middleware.rb, line 10
def call(env)
  # clear out the profiler's data
  GC::Profiler.clear

  # pass the call onto the next link in the chain
  status, headers, response = @app.call(env)

  # pass the results back
  [status, headers, response]
end