class Roda::RodaPlugins::Middleware::Forwarder

Forward instances are what is actually used as middleware.

def call(env)

pass handling of the request to the next middleware.
If this returns a result, return that result directly. Otherwise,
When calling the middleware, first call the current middleware.
def call(env)
  res = nil
  call_next = catch(:next) do
    env[@mid.opts[:middleware_env_var]] = true
    res = @mid.call(env)
    false
  end
  if call_next
    @app.call(env)
  else
    res
  end
end

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

Store the current middleware and the next middleware to call.
def initialize(mid, app, *args, &block)
  @mid = if configure = mid.opts[:middleware_configure]
    mid = Class.new(mid)
    configure.call(mid, *args, &block)
    mid
  else
    raise RodaError, "cannot provide middleware args or block unless loading middleware plugin with a block" if block || !args.empty?
    mid
  end
  @app = app
end