Class: OLogger::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



3
4
5
# File 'lib/ologger/middleware.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#_call(env) ⇒ Object



11
12
13
14
15
16
# File 'lib/ologger/middleware.rb', line 11

def _call(env)
  OLogger.buffer.flush
  @status, @headers, @response = @app.call(env)
  OLogger.buffer.write
  [@status, @headers, self]
end

#call(env) ⇒ Object



7
8
9
# File 'lib/ologger/middleware.rb', line 7

def call(env)
  dup._call(env)
end

#each(&block) ⇒ Object



18
19
20
# File 'lib/ologger/middleware.rb', line 18

def each(&block)
  @response.each(&block)
end