class MyMiddleware def initialize(app) @app = app end def call(env) status, headers, body = @app.call(env) # ... return [status, headers, body] end end