Class: Rack::FlashSession
- Inherits:
-
Object
- Object
- Rack::FlashSession
- Defined in:
- lib/rack/flash-session.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, *args) ⇒ FlashSession
constructor
A new instance of FlashSession.
Constructor Details
#initialize(app, *args) ⇒ FlashSession
Returns a new instance of FlashSession.
6 7 8 9 10 |
# File 'lib/rack/flash-session.rb', line 6 def initialize(app, *args) args = ['_session_id'] if args.empty? @app = app @session_keys = args end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/rack/flash-session.rb', line 12 def call(env) if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/ then params = ::Rack::Request.new(env).params env['HTTP_COOKIE'] = params.select{|k,v| @session_keys.include?(k)}.map{|k,v| [k, ::Rack::Utils.escape(v)].join('=')}.join(';') end @app.call(env) end |