Class: CGI::Session::PStore
- Defined in:
- lib/action_controller/cgi_ext/session.rb
Overview
-
Don’t require ‘digest/md5’ whenever a new session is started.
Instance Method Summary collapse
-
#initialize(session, option = {}) ⇒ PStore
constructor
:nodoc:.
Constructor Details
#initialize(session, option = {}) ⇒ PStore
:nodoc:
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/action_controller/cgi_ext/session.rb', line 51 def initialize(session, option={}) dir = option['tmpdir'] || Dir::tmpdir prefix = option['prefix'] || '' id = session.session_id md5 = Digest::MD5.hexdigest(id)[0,16] path = dir+"/"+prefix+md5 path.untaint if File::exist?(path) @hash = nil else unless session.new_session raise CGI::Session::NoSession, "uninitialized session" end @hash = {} end @p = ::PStore.new(path) @p.transaction do |p| File.chmod(0600, p.path) end end |