method

new

rails latest stable - Class: CGI::Session::PStore

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.2.1) is shown here.

new(session, option={})
public

No documentation available.

# File actionpack/lib/action_controller/cgi_ext/session.rb, line 31
      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