Sha256: 424c231ed326ebdb7f77e3a7b3651240227d61f974df69dd421bbb070306d2ca
Contents?: true
Size: 514 Bytes
Versions: 1
Compression:
Stored size: 514 Bytes
Contents
class SiteHub module Middleware def middlewares @middleware ||= [] end def use(middleware_clazz, *args, &block) middlewares << [middleware_clazz, args, block || proc {}] end def apply_middleware(forward_proxy) middlewares.reverse.inject(forward_proxy) do |app, middleware_def| middleware = middleware_def[0] args = middleware_def[1] || [] block = middleware_def[2] || proc {} middleware.new(app, *args, &block) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sitehub-0.4.3 | lib/sitehub/middleware.rb |