call
の返り値の順序とRack::Response.new
の引数の順序が違ったのでメモ。*
で展開できたら楽だったのになあ。
class GreatMiddleware def initialize(app) @app = app end def call(env) result = @app.call(env) response = Rack::Response.new(result[2], result[0], result[1]) great_method(response) return result end private def great_method(response) # snip end end