Sha256: d72f009e1c719fb07093cc0e482bae0dd4fce6822669e7b0ba70784a184e49d3
Contents?: true
Size: 725 Bytes
Versions: 9
Compression:
Stored size: 725 Bytes
Contents
# encoding: utf-8 module Warden module Serializers # A session serializer provided by Warden. You need to implement the serialize and deserialize # methods in order to use it. class Session < Base def store(user, scope) session[key_for(scope)] = serialize(user) end def fetch(scope) key = session[key_for(scope)] return nil unless key user = deserialize(key) delete(scope) unless user user end def stored?(scope) !!session[key_for(scope)] end def delete(scope, user=nil) session.delete(key_for(scope)) end end # Session Serializers.add(:session, Session) end # Serializers end # Warden
Version data entries
9 entries across 9 versions & 1 rubygems