aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-23 19:31:18 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-23 19:31:18 +0000
commite32e0a2d3d75df947cb547b315e23c4fbd36d906 (patch)
tree84e6753bf5981f615df93461edbc3e11b3392a52
parent63360be4d23fabf6db811e10770fabd326a703fa (diff)
downloadruby-e32e0a2d3d75df947cb547b315e23c4fbd36d906.tar.gz
* lib/pstore.rb: split executable code into sample directory.
* sample/pstore.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/pstore.rb22
-rw-r--r--sample/pstore.rb19
3 files changed, 24 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 9aecdaeae8..eb6ed98244 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jul 24 04:29:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+
+ * lib/pstore.rb: split executable code into sample directory.
+ * sample/pstore.rb: ditto.
+
Wed Jul 23 23:50:11 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/defines.h, siphash.c, st.c (UNALIGNED_WORD_ACCESS):
diff --git a/lib/pstore.rb b/lib/pstore.rb
index a2813a8e20..02c20c91c7 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -482,25 +482,3 @@ class PStore
EMPTY_MARSHAL_CHECKSUM
end
end
-
-# :enddoc:
-
-if __FILE__ == $0
- db = PStore.new("/tmp/foo")
- db.transaction do
- p db.roots
- ary = db["root"] = [1,2,3,4]
- ary[1] = [1,1.5]
- end
-
- 1000.times do
- db.transaction do
- db["root"][0] += 1
- p db["root"][0]
- end
- end
-
- db.transaction(true) do
- p db["root"]
- end
-end
diff --git a/sample/pstore.rb b/sample/pstore.rb
new file mode 100644
index 0000000000..38c2305516
--- /dev/null
+++ b/sample/pstore.rb
@@ -0,0 +1,19 @@
+require 'pstore'
+
+db = PStore.new("/tmp/foo")
+db.transaction do
+ p db.roots
+ ary = db["root"] = [1,2,3,4]
+ ary[1] = [1,1.5]
+end
+
+1000.times do
+ db.transaction do
+ db["root"][0] += 1
+ p db["root"][0]
+ end
+end
+
+db.transaction(true) do
+ p db["root"]
+end