Method: Innate::SingletonMethods#middleware

Defined in:
lib/innate.rb

#middleware(mode, &block) ⇒ Object

Sets the middleware for the given mode.

Examples:

Innate.middleware(:dev) do
  use Rack::Head
  use Rack::Reloader

  run Innate.core
end

Parameters:

  • mode (#to_sym)

    The mode that the middleware belong to.

  • block (Proc)

    Block containing the middleware. This block will be passed to an instance of Rack::Builder and can thus contain everything this class allows you to use.



238
239
240
241
242
# File 'lib/innate.rb', line 238

def middleware(mode, &block)
  MIDDLEWARE[mode.to_sym] = block

  recompile_middleware
end