Class Rack::Session::Cookie
In: lib/rack/session/cookie.rb
Parent: Object

Rack::Session::Cookie provides simple cookie based session management. The session is a Ruby Hash stored as base64 encoded marshalled data set to :key (default: rack.session). When the secret key is set, cookie data is checked for data integrity.

Example:

    use Rack::Session::Cookie, :key => 'rack.session',
                               :domain => 'foo.com',
                               :path => '/',
                               :expire_after => 2592000,
                               :secret => 'change_me'

    All parameters are optional.

Methods

call   new  

Public Class methods

[Source]

    # File lib/rack/session/cookie.rb, line 24
24:       def initialize(app, options={})
25:         @app = app
26:         @key = options[:key] || "rack.session"
27:         @secret = options[:secret]
28:         @default_options = {:domain => nil,
29:           :path => "/",
30:           :expire_after => nil}.merge(options)
31:       end

Public Instance methods

[Source]

    # File lib/rack/session/cookie.rb, line 33
33:       def call(env)
34:         load_session(env)
35:         status, headers, body = @app.call(env)
36:         commit_session(env, status, headers, body)
37:       end

[Validate]