Module: Roda::RodaPlugins::Middleware::ClassMethods

Defined in:
lib/roda/plugins/middleware.rb

Instance Method Summary collapse

Instance Method Details

#new(app) ⇒ Object

Create a Forwarder instead of a new instance.



66
67
68
# File 'lib/roda/plugins/middleware.rb', line 66

def new(app)
  Forwarder.new(self, app)
end

#route(&block) ⇒ Object

Override the route block so that if no route matches, we throw so that the next middleware is called.



72
73
74
75
76
77
# File 'lib/roda/plugins/middleware.rb', line 72

def route(&block)
  super do |r|
    instance_exec(r, &block)
    throw :next, true
  end
end