Class: FlashSessionCookieMiddleware
- Inherits:
-
Object
- Object
- FlashSessionCookieMiddleware
- Defined in:
- lib/papermill/flash_session_cookie_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, session_key = '_session_id') ⇒ FlashSessionCookieMiddleware
constructor
A new instance of FlashSessionCookieMiddleware.
Constructor Details
#initialize(app, session_key = '_session_id') ⇒ FlashSessionCookieMiddleware
Returns a new instance of FlashSessionCookieMiddleware.
4 5 6 7 |
# File 'lib/papermill/flash_session_cookie_middleware.rb', line 4 def initialize(app, session_key = '_session_id') @app = app @session_key = session_key end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/papermill/flash_session_cookie_middleware.rb', line 9 def call(env) if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/ params = ::Rack::Request.new(env).params env['HTTP_COOKIE'] = [ @session_key, params[@session_key] ].join('=').freeze unless params[@session_key].nil? end @app.call(env) end |