Harbor Documentation

Harbor::Session::Abstract

Defines the API and default behavior for session stores. See Cookie, and contrib/session/data_mapper for examples of usage.

Public Class Methods

commit_session(data, request)

Receives the session data hash, and should return the data to be set for the cookie’s value

      # File lib/harbor/session/abstract.rb, line 21
21:       def self.commit_session(data, request)
22:         [Marshal.dump(data)].pack("m*")
23:       end

load_session(delegate, cookie, request = nil)

Receives the raw cookie data, and should return a hash of the data for the session.

      # File lib/harbor/session/abstract.rb, line 13
13:       def self.load_session(delegate, cookie, request = nil)
14:         Marshal.load(cookie.unpack("m*")[0]) rescue {}
15:       end