Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1b35011947
Fetching contributors…

Cannot retrieve contributors at this time

file 30 lines (24 sloc) 0.608 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
module RackSessionAccess
  autoload :Middleware, 'rack_session_access/middleware'

  class << self
    # session resource path
    attr_accessor :path

    # session resource edit path
    attr_accessor :edit_path

    # encode session hash to string
    def encode(hash)
      [Marshal.dump(hash)].pack('m')
    end

    # decode string to session hash
    def decode(string)
      Marshal.load(string.unpack('m').first)
    end

    def configure
      yield self
    end
  end
end

RackSessionAccess.configure do |config|
  config.path = '/rack_session'
  config.edit_path = '/rack_session/edit'
end
Something went wrong with that request. Please try again.