Class: Grandstand::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/grandstand/session.rb

Overview

:nodoc: all

Instance Method Summary collapse

Constructor Details

#initialize(app, session_key = '_session_id') ⇒ Session

Returns a new instance of Session.



3
4
5
6
# File 'lib/grandstand/session.rb', line 3

def initialize(app, session_key = '_session_id')
  @app = app
  @session_key = session_key
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/grandstand/session.rb', line 8

def call(env)
  if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/ && env['PATH_INFO'] =~ /^\/grandstand\/galleries\/\d+\/images$/
    params = Rack::Request.new(env).POST
    env['HTTP_COOKIE'] = [ @session_key, params.delete('session_key') ].join('=').freeze unless params['session_key'].nil?
  end
  @app.call(env)
end