module Roda::RodaPlugins::Middleware::ClassMethods
Public Instance Methods
new(app=nil)
click to toggle source
If an argument is given, this is a middleware app, so create a Forwarder
. Otherwise, this is a usual instance creation, so call super.
Calls superclass method
# File lib/roda/plugins/middleware.rb, line 67 def new(app=nil) if app Forwarder.new(self, app) else super() end end
route(&block)
click to toggle source
Override the route block so that if no route matches, we throw so that the next middleware is called.
Calls superclass method
# File lib/roda/plugins/middleware.rb, line 77 def route(&block) super do |r| instance_exec(r, &block) throw :next, true end end