Class: Object::Profiler::Middleware

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Middleware.



6
7
8
9
10
# File 'lib/object/profiler/middleware.rb', line 6

def initialize(app, options={})
  @app    = app
  @output = options[:output] ? File.open(options[:output], 'w+') : STDOUT

end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
# File 'lib/object/profiler/middleware.rb', line 12

def call(env)
  Object::Profiler.track(@output) { 
    @app.call(env)
  }
end