Class: Fakeit::Middleware::Recorder

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Recorder

Returns a new instance of Recorder.



4
5
6
# File 'lib/fakeit/middleware/recorder.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
# File 'lib/fakeit/middleware/recorder.rb', line 8

def call(env)
  env
    .tap(&method(:log_request))
    .then { @app.call(_1) }
    .tap(&method(:log_response))
end