Module: Roda::RodaPlugins::Middleware::InstanceMethods

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

Instance Method Summary collapse

Instance Method Details

#_roda_run_main_route(r) ⇒ Object

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



145
146
147
148
149
# File 'lib/roda/plugins/middleware.rb', line 145

def _roda_run_main_route(r)
  res = super
  throw :next, true if r.forward_next
  res
end

#call(&block) ⇒ Object

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



135
136
137
138
139
140
141
# File 'lib/roda/plugins/middleware.rb', line 135

def call(&block)
  super do |r|
    res = instance_exec(r, &block) # call Fallback
    throw :next, true if r.forward_next
    res
  end
end