Module: Roda::RodaPlugins::NotFound

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

Overview

The not_found plugin adds a not_found class method which sets a block that is called whenever a 404 response with an empty body would be returned. The usual use case for this is the desire for nice error pages if the page is not found.

You can provide the block with the plugin call:

plugin :not_found do
  "Where did it go?"
end

Or later via a separate call to not_found:

plugin :not_found

not_found do
  "Where did it go?"
end

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.configure(app, &block) ⇒ Object

If a block is given, install the block as the not_found handler.



23
24
25
26
27
# File 'lib/roda/plugins/not_found.rb', line 23

def self.configure(app, &block)
  if block
    app.not_found(&block)
  end
end