def stack(name = nil, opts = {})
      if self::StackMiddleware._mwares[name] && mw = self::StackMiddleware._mwares[name]
        unless mw.stack == self
          mw = self::StackMiddleware._mwares[name] = self::StackMiddleware._mwares[name].dup
        end
        mw
      else
        self::StackMiddleware.new(name, self, opts)
      end
    end
def stack(name = nil, opts = {})
      if self::StackMiddleware._mwares[name] && mw = self::StackMiddleware._mwares[name]
        unless mw.stack == self
          mw = self::StackMiddleware._mwares[name] = self::StackMiddleware._mwares[name].dup
        end
        mw
      else
        self::StackMiddleware.new(name, self, opts)
      end
    end
Useful for adding additional information into your middleware stack  definition

 @param [Object] name
   The name of a given middleware.  Each piece of middleware has a name in the stack.
   By naming middleware we can refer to it later, swap it out for a different class or even just remove it from the stack.
 @param        [Hash] opts An options hash
 @option opts [Object] :before
   Sets this middlware to be run after the middleware named.  Name is either the name given to the
   middleware stack, or the Middleware class itself.
 @option opts [Object] :after
   Sets this middleware to be run after the middleware name.  Name is either the name given to the
   middleware stack or the Middleware class itself.

 @example Declaring un-named middleware via the stack
   MyClass.stack.use(MyMiddleware)

 This middleware will be named MyMiddleware, and can be specified with (:before | :after) => MyMiddleware

 @example Declaring a named middleware via the stack
   MyClass.stack(:foo).use(MyMiddleware)

 This middleware will be named :foo and can be specified with (:before | :after) => :foo

 @example Declaring a named middleware with a :before key
   MyClass.stack(:foo, :before => :bar).use(MyMiddleware)

 This middleware will be named :foo and will be run before the middleware named :bar
 If :bar is not run, :foo will not be run either

 @example Declaring a named middlware with an :after key
   MyClass.stack(:foo, :after => :bar).use(MyMiddleware)

 This middleware will be named :foo and will be run after the middleware named :bar
 If :bar is not run, :foo will not be run either

 @see Pancake::Middleware#use
 @api public
 @since 0.1.0
 @author Daniel Neighman