mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
63360be4d2
commit
e32e0a2d3d
3 changed files with 24 additions and 22 deletions
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
19
sample/pstore.rb
Normal file
19
sample/pstore.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue