Class: Harbor::Session::Abstract
- Inherits:
-
Object
- Object
- Harbor::Session::Abstract
- Defined in:
- lib/harbor/session/abstract.rb
Overview
Defines the API and default behavior for session stores. See Cookie, and contrib/session/data_mapper for examples of usage.
Direct Known Subclasses
Class Method Summary collapse
-
.commit_session(data) ⇒ Object
Receives the session data hash, and should return the data to be set for the cookie’s value.
-
.load_session(cookie) ⇒ Object
Receives the raw cookie data, and should return a hash of the data for the session.
Class Method Details
.commit_session(data) ⇒ Object
Receives the session data hash, and should return the data to be set for the cookie’s value
21 22 23 |
# File 'lib/harbor/session/abstract.rb', line 21 def self.commit_session(data) [Marshal.dump(data)].pack("m*") end |
.load_session(cookie) ⇒ Object
Receives the raw cookie data, and should return a hash of the data for the session.
13 14 15 |
# File 'lib/harbor/session/abstract.rb', line 13 def self.load_session() Marshal.load(.unpack("m*")[0]) rescue {} end |