Sha256: 1e13d56cec918492a01c32cd540cd9d7b331611f731d00bb827a1c9f1377d5a6
Contents?: true
Size: 587 Bytes
Versions: 2
Compression:
Stored size: 587 Bytes
Contents
# Using the `rack.after_reply` hook provided by Puma for running code after # the response has been sent to the client. class CaptainConfig::PumaMiddleware RACK_AFTER_REPLY = ::Puma::Const::RACK_AFTER_REPLY def initialize(app) @app = app end def call(env) service = CaptainConfig::Service.last_created_service if service # Load if it hasn't already been loaded (eg. first request). service.load unless service.loaded? # Then reload after every request. env[RACK_AFTER_REPLY] << lambda { service.load } end @app.call env end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
captain_config-1.1.0 | lib/captain_config/middlewares/puma_middleware.rb |
captain_config-1.0.0 | lib/captain_config/middlewares/puma_middleware.rb |