module Roda::RodaPlugins::Middleware::ClassMethods

def new(app)

Create a Forwarder instead of a new instance if a non-Hash is given.
def new(app)
  if app.is_a?(Hash)
    super
  else
    Forwarder.new(self, app)
  end
end

def route(*args, &block)

that the next middleware is called.
Override the route block so that if no route matches, we throw so
def route(*args, &block)
  super do |r|
    res = instance_exec(r, &block)
    throw :next, true if r.forward_next
    res
  end
end