Sha256: 9c21d1f45e8d173f6e0fe58b0b8a8c76da38e81c1fa5bc9e45cb38b7f096018e

Contents?: true

Size: 631 Bytes

Versions: 5

Compression:

Stored size: 631 Bytes

Contents

require 'rack_datamapper/session/abstract/store'
module Ixtlan
  class SessionWithCache < DataMapper::Session::Abstract::Session

    def data=(data)
      d = {}
      data.each{|k,v| d[k.to_sym] = v}
      @user = d.delete(:user)
      @flash = d.delete(:flash)
      @expires_at = d.delete(:expires_at)
      attribute_set(:raw_data, ::Base64.encode64(Marshal.dump(d)))
    end

    def data
      # use string key for flash entry to allow the rails flash to work properly !
      Marshal.load(::Base64.decode64(attribute_get(:raw_data))).merge({:user => @user, "flash" => @flash, :expires_at => @expires_at})
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ixtlan-0.4.3 lib/ixtlan/session_with_cache.rb
ixtlan-0.4.2 lib/ixtlan/session_with_cache.rb
ixtlan-0.4.1 lib/ixtlan/session_with_cache.rb
ixtlan-0.4.0 lib/ixtlan/session_with_cache.rb
ixtlan-0.4.0.pre5 lib/ixtlan/session_with_cache.rb