summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/cgi/session/pstore.rb13
-rw-r--r--lib/open3.rb13
-rw-r--r--sample/cgi-session-pstore.rb11
-rw-r--r--sample/open3.rb12
5 files changed, 29 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index e86f965..e9da3d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Aug 10 10:34:00 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+
+ * lib/cgi/session/pstore.rb: separated sample code.
+ * lib/open3.rb: ditto.
+
Sun Aug 10 10:03:24 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* lib/irb/ext/multi-irb.rb: removed commented-out code.
diff --git a/lib/cgi/session/pstore.rb b/lib/cgi/session/pstore.rb
index a63d7d3..7534314 100644
--- a/lib/cgi/session/pstore.rb
+++ b/lib/cgi/session/pstore.rb
@@ -97,15 +97,4 @@ class CGI
end
end
end
-
-if $0 == __FILE__
- # :enddoc:
- 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
+# :enddoc:
diff --git a/lib/open3.rb b/lib/open3.rb
index 543be75..e80b1cd 100644
--- a/lib/open3.rb
+++ b/lib/open3.rb
@@ -661,16 +661,3 @@ module Open3
end
end
-
-if $0 == __FILE__
- 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
-end
diff --git a/sample/cgi-session-pstore.rb b/sample/cgi-session-pstore.rb
new file mode 100644
index 0000000..99d7d47
--- /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 0000000..bc6cdfe
--- /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