Class: Restapi::Extractor::Recorder::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/restapi/extractor/recorder.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



86
87
88
# File 'lib/restapi/extractor/recorder.rb', line 86

def initialize(app)
  @app = app
end

Instance Method Details

#analyze(env, &block) ⇒ Object



96
97
98
99
100
101
102
103
# File 'lib/restapi/extractor/recorder.rb', line 96

def analyze(env, &block)
  Restapi::Extractor.call_recorder.analyse_env(env)
  response = block.call
  Restapi::Extractor.call_recorder.analyse_response(response)
  response
ensure
  Restapi::Extractor.call_finished
end

#call(env) ⇒ Object



90
91
92
93
94
# File 'lib/restapi/extractor/recorder.rb', line 90

def call(env)
  analyze(env) do
    @app.call(env)
  end
end