class ActionController::MiddlewareStack::Middleware

def initialize(klass, *args, &block)

:nodoc:
:nodoc:

end
use AuthenticationMiddleware, except: [:index, :show]
class PostsController < ApplicationController

allowing the following syntax in controllers:
Extend ActionDispatch middleware stack to make it aware of options
def initialize(klass, *args, &block)
  options = args.extract_options!
  @only   = Array(options.delete(:only)).map(&:to_s)
  @except = Array(options.delete(:except)).map(&:to_s)
  args << options unless options.empty?
  super
end