-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* lib/matrix.rb: remove elements conversion to_f, to_i, to_r.
* lib/cgi/session/pstore.rb: add new file. * process.c (proc_getgroups, proc_setmaxgroups): fix typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
- Loading branch information
matz
committed
Jul 15, 2003
1 parent
bdfce14
commit 9ef8a2a
Showing
6 changed files
with
98 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
Tue Jul 15 14:38:21 2003 Yukihiro Matsumoto <[email protected]> | ||
|
||
* lib/matrix.rb: remove elements conversion to_f, to_i, to_r. | ||
|
||
* lib/cgi/session/pstore.rb: add new file. | ||
|
||
Tue Jul 15 03:30:41 2003 why the lucky stiff <[email protected]> | ||
|
||
* ext/syck/rubyext.c (syck_mark_emitter): forgot to rb_gc_mark the | ||
outgoing IO object. | ||
* ext/syck/rubyext.c (syck_mark_emitter): forgot to rb_gc_mark the | ||
outgoing IO object. | ||
|
||
Sun Jul 13 14:55:36 2003 Koji Arai <[email protected]> | ||
|
||
* process.c (proc_getgroups, proc_setmaxgroups): fix typo. | ||
|
||
Sat Jul 12 17:01:28 2003 NAKAMURA Usaku <[email protected]> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
require 'cgi/session' | ||
require 'pstore' | ||
|
||
class CGI | ||
class Session | ||
def []=(key, val) | ||
unless @write_lock | ||
@write_lock = true | ||
end | ||
unless @data | ||
@data = @dbman.restore | ||
end | ||
#@data[key] = String(val) | ||
@data[key] = val | ||
end | ||
|
||
class PStore | ||
def check_id(id) | ||
/[^0-9a-zA-Z]/ =~ id.to_s ? false : true | ||
end | ||
|
||
def initialize session, option={} | ||
dir = option['tmpdir'] || ENV['TMP'] || '/tmp' | ||
prefix = option['prefix'] || '' | ||
id = session.session_id | ||
unless check_id(id) | ||
raise ArgumentError, "session_id `%s' is invalid" % id | ||
end | ||
path = dir+"/"+prefix+id | ||
path.untaint | ||
unless File::exist? path | ||
@hash = {} | ||
end | ||
@p = ::PStore.new path | ||
end | ||
|
||
def restore | ||
unless @hash | ||
@p.transaction do | ||
begin | ||
@hash = @p['hash'] | ||
rescue | ||
@hash = {} | ||
end | ||
end | ||
end | ||
@hash | ||
end | ||
|
||
def update | ||
@p.transaction do | ||
@p['hash'] = @hash | ||
end | ||
end | ||
|
||
def close | ||
update | ||
end | ||
|
||
def delete | ||
path = @p.path | ||
File::unlink path | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
if $0 == __FILE__ | ||
STDIN.reopen("/dev/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"}' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters