lib/hanami/middleware.rb in hanami-1.0.0.beta2 vs lib/hanami/middleware.rb in hanami-1.0.0.beta3
- old
+ new
@@ -61,10 +61,21 @@
# @return [Array] the middleware that was added
#
# @since 0.2.0
#
# @see Hanami::Middleware#prepend
+ #
+ # @example
+ # # apps/web/application.rb
+ # module Web
+ # class Application < Hanami::Application
+ # configure do
+ # # ...
+ # use MyRackMiddleware, foo: 'bar'
+ # end
+ # end
+ # end
def use(middleware, *args, &blk)
stack.push [middleware, args, blk]
stack.uniq!
end
@@ -77,10 +88,21 @@
# @return [Array] the middleware that was added
#
# @since 0.6.0
#
# @see Hanami::Middleware#use
+ #
+ # @example
+ # # apps/web/application.rb
+ # module Web
+ # class Application < Hanami::Application
+ # configure do
+ # # ...
+ # prepend MyRackMiddleware, foo: 'bar'
+ # end
+ # end
+ # end
def prepend(middleware, *args, &blk)
stack.unshift [middleware, args, blk]
stack.uniq!
end
@@ -107,9 +129,11 @@
else
middleware
end
end
+ # @api private
+ # @since 0.9.0
def routes
Components["#{configuration.app_name}.routes"]
end
# @api private