Class: Memprof::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/memprof/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, opts = {}) ⇒ Middleware

Returns a new instance of Middleware.



4
5
6
7
# File 'lib/memprof/middleware.rb', line 4

def initialize(app, opts = {})
  @app = app
  @options = opts
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/memprof/middleware.rb', line 8

def call(env)
  ret = nil
  Memprof.track{
    ret = @app.call(env)
    puts
    puts '-' * 80
    puts '-' * 80
    if @options[:force_gc]
      puts "Forcing GC...."
      GC.start
    end
  }
  ret
end