End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
CGI::Session::FileStore#restore
restore
lib/cgi/session.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/cgi/session.rb, line 424
def restore
unless @hash
@hash = {}
begin
lockf = File.open(@path+".lock", "r")
lockf.flock File::LOCK_SH
f = File.open(@path, 'r')
for line in f
line.chomp!
k, v = line.split('=',2)
@hash[CGI.unescape(k)] = Marshal.restore(CGI.unescape(v))
end
ensure
f&.close
lockf&.close
end
end
@hash
end
Restore session state from the session’s FileStore file.
Returns the session state as a hash.