Class: Rack::Session::Abstract::ID
- Defined in:
- lib/gems/rack-0.9.1/lib/rack/session/abstract/id.rb
Overview
ID sets up a basic framework for implementing an id based sessioning service. Cookies sent to the client for maintaining sessions will only contain an id reference. Only #get_session and #set_session should need to be overwritten.
All parameters are optional.
-
:key determines the name of the cookie, by default it is ‘rack.session’
-
:domain and :path set the related cookie values, by default domain is nil, and the path is ‘/’.
-
:expire_after is the number of seconds in which the session cookie will expire. By default it is set not to provide any expiry time.
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :key => 'rack.session', :path => '/', :domain => nil, :expire_after => nil, :secure => false, :httponly => true, :sidbits => 128 }
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #context(app) ⇒ Object
-
#initialize(app, options = {}) ⇒ ID
constructor
A new instance of ID.
Constructor Details
#initialize(app, options = {}) ⇒ ID
Returns a new instance of ID.
35 36 37 38 39 |
# File 'lib/gems/rack-0.9.1/lib/rack/session/abstract/id.rb', line 35 def initialize(app, ={}) @default_options = self.class::DEFAULT_OPTIONS.merge() @key = @default_options[:key] @default_context = context app end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
24 25 26 |
# File 'lib/gems/rack-0.9.1/lib/rack/session/abstract/id.rb', line 24 def key @key end |
Instance Method Details
#call(env) ⇒ Object
41 42 43 |
# File 'lib/gems/rack-0.9.1/lib/rack/session/abstract/id.rb', line 41 def call(env) @default_context.call(env) end |