Class: ActionDispatch::Session::AbstractStore
- Inherits:
-
Object
- Object
- ActionDispatch::Session::AbstractStore
- Defined in:
- actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
Constant Summary
Instance Method Summary (collapse)
- - (Object) call(env)
-
- (AbstractStore) initialize(app, options = {})
constructor
A new instance of AbstractStore.
Constructor Details
- (AbstractStore) initialize(app, options = {})
A new instance of AbstractStore
139 140 141 142 143 144 145 |
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 139 def initialize(app, = {}) @app = app @default_options = DEFAULT_OPTIONS.merge() @key = @default_options.delete(:key).freeze @cookie_only = @default_options.delete(:cookie_only) ensure_session_key! end |
Instance Method Details
- (Object) call(env)
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 147 def call(env) prepare!(env) response = @app.call(env) session_data = env[ENV_SESSION_KEY] = env[ENV_SESSION_OPTIONS_KEY] if !session_data.is_a?(AbstractStore::SessionHash) || session_data.loaded? || [:expire_after] session_data.send(:load!) if session_data.is_a?(AbstractStore::SessionHash) && !session_data.loaded? sid = [:id] || generate_sid session_data = session_data.to_hash value = set_session(env, sid, session_data) return response unless value = { :value => value } unless [:expire_after].nil? [:expires] = Time.now + .delete(:expire_after) end request = ActionDispatch::Request.new(env) (request, .merge!()) end response end |