Class: Apipie::Extractor::Recorder::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



87
88
89
# File 'lib/apipie/extractor/recorder.rb', line 87

def initialize(app)
  @app = app
end

Instance Method Details

#analyze(env, &block) ⇒ Object



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

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

#call(env) ⇒ Object



91
92
93
94
95
# File 'lib/apipie/extractor/recorder.rb', line 91

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