module Roda::RodaPlugins::Middleware::InstanceMethods

  1. lib/roda/plugins/middleware.rb

Methods

Public Instance

  1. _roda_run_main_route
  2. call

Public Instance methods

_roda_run_main_route(r)

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

[show source]
    # File lib/roda/plugins/middleware.rb
211 def _roda_run_main_route(r)
212   res = super
213   if r.forward_next
214     r.env['roda.response_headers'] = response.headers if self.class.middleware_forward_response_headers
215     throw :next, true
216   end
217   res
218 end
call(&block)

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

[show source]
    # File lib/roda/plugins/middleware.rb
198 def call(&block)
199   super do |r|
200     res = instance_exec(r, &block) # call Fallback
201     if r.forward_next
202       r.env['roda.response_headers'] = response.headers if self.class.middleware_forward_response_headers
203       throw :next, true
204     end
205     res
206   end
207 end