The functionality I am looking for is similar to the rake middleware
command in Rails, except for a generic rack application.
This will return a list of all the middleware for a rack application:
def middleware_classes(app)
app.instance_variable_get(:@use).map{|middleware| middleware.call.class.name }
end
app = Rack::Builder.parse_file('config.ru').first; nil # trailing nil to avoid paging in an interactive console
p middleware_classes(app)