Class: Rack::Session::Abstract::ID
- Inherits:
-
Object
- Object
- Rack::Session::Abstract::ID
- Defined in:
- 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 }
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.
30 31 32 33 34 |
# File 'lib/rack/session/abstract/id.rb', line 30 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.
22 23 24 |
# File 'lib/rack/session/abstract/id.rb', line 22 def key @key end |
Instance Method Details
#call(env) ⇒ Object
36 37 38 |
# File 'lib/rack/session/abstract/id.rb', line 36 def call(env) @default_context.call(env) end |