ruby/sample/cgi-session-pstore.rb

12 строки
328 B
Ruby

require 'cgi'
require 'cgi/session/pstore'
STDIN.reopen(IO::NULL)
cgi = CGI.new
session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore)
session['key'] = {'k' => 'v'}
puts session['key'].class
fail unless Hash === session['key']
puts session['key'].inspect
fail unless session['key'].inspect == '{"k"=>"v"}'