Module: Roda::RodaPlugins::RunHandler::RequestMethods

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

Instance Method Summary collapse

Instance Method Details

#run(app, opts = OPTS) {|res| ... } ⇒ Object

If a block is given, yield the rack response array to it. The response can be modified before it is returned by the current app.

If the not_found: :pass option is given, and the rack response returned by the app is a 404 response, do not return the response, continue routing normally.

Yields:

  • (res)


35
36
37
38
39
# File 'lib/roda/plugins/run_handler.rb', line 35

def run(app, opts=OPTS)
  res = catch(:halt){super(app)}
  yield res if block_given?
  throw(:halt, res) unless opts[:not_found] == :pass && res[0] == 404
end