diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-10 01:34:50 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-10 01:34:50 +0000 |
commit | ffc068c9bba4c731b06f7e4391fb6a33e101f334 (patch) | |
tree | fa0414841c5611c0b73a6ca0e7b8163e1738466e /sample | |
parent | 31a1d0621c391d2d58918d51f0505e3044876822 (diff) | |
download | ruby-ffc068c9bba4c731b06f7e4391fb6a33e101f334.tar.gz |
* lib/cgi/session/pstore.rb: separated sample code.
* lib/open3.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r-- | sample/cgi-session-pstore.rb | 11 | ||||
-rw-r--r-- | sample/open3.rb | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/sample/cgi-session-pstore.rb b/sample/cgi-session-pstore.rb new file mode 100644 index 0000000000..99d7d479e2 --- /dev/null +++ b/sample/cgi-session-pstore.rb @@ -0,0 +1,11 @@ +require 'cgi' +require 'cgi/session/pstore' + +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"}' diff --git a/sample/open3.rb b/sample/open3.rb new file mode 100644 index 0000000000..bc6cdfe3bf --- /dev/null +++ b/sample/open3.rb @@ -0,0 +1,12 @@ +require 'open3' + +a = Open3.popen3("nroff -man") +Thread.start do + while line = gets + a[0].print line + end + a[0].close +end +while line = a[1].gets + print ":", line +end |