class Roda::RodaPlugins::Middleware::Forwarder

def initialize(mid, app, *args, &block)

and store +app+ as the next middleware to call.
Make a subclass of +mid+ to use as the current middleware,
def initialize(mid, app, *args, &block)
  @mid = Class.new(mid)
  # :nocov:
  @mid.set_temporary_name("#{mid.name}(middleware)") if mid.name && RUBY_VERSION >= "3.3"
  # :nocov:
  if @mid.opts[:middleware_next_if_not_found]
    @mid.plugin(:not_found, &NEXT_PROC)
  end
  if configure = @mid.opts[:middleware_configure]
    configure.call(@mid, *args, &block)
  elsif block || !args.empty?
    raise RodaError, "cannot provide middleware args or block unless loading middleware plugin with a block"
  end
  @app = app
end