bandicoot 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/bandicoot/msgpack_time.rb +7 -0
- data/lib/bandicoot/save_file.rb +13 -7
- data/lib/bandicoot/version.rb +1 -1
- metadata +5 -4
data/lib/bandicoot/save_file.rb
CHANGED
@@ -22,6 +22,7 @@ module Bandicoot
|
|
22
22
|
|
23
23
|
def write(key, retval)
|
24
24
|
file.write([key, retval].to_msgpack)
|
25
|
+
#file.fsync
|
25
26
|
end
|
26
27
|
|
27
28
|
def close
|
@@ -31,14 +32,19 @@ module Bandicoot
|
|
31
32
|
protected
|
32
33
|
def self.read_save_points(file)
|
33
34
|
hash = SavePointHash.new
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
begin
|
36
|
+
MessagePack::Unpacker.new(file).each do |key, retval|
|
37
|
+
c = hash
|
38
|
+
key.each do |x|
|
39
|
+
c[x] ||= SavePointHash.new
|
40
|
+
c = c[x]
|
41
|
+
end
|
42
|
+
c.complete = true
|
43
|
+
c.ret_val = retval
|
39
44
|
end
|
40
|
-
|
41
|
-
|
45
|
+
rescue EOFError
|
46
|
+
#nop, of course exceptions should be used for flow control
|
47
|
+
# silly me to think otherwise.
|
42
48
|
end
|
43
49
|
p hash
|
44
50
|
hash
|
data/lib/bandicoot/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bandicoot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ben Hughes
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-16 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- bandicoot.gemspec
|
78
78
|
- lib/bandicoot.rb
|
79
79
|
- lib/bandicoot/context.rb
|
80
|
+
- lib/bandicoot/msgpack_time.rb
|
80
81
|
- lib/bandicoot/save_file.rb
|
81
82
|
- lib/bandicoot/save_point_hash.rb
|
82
83
|
- lib/bandicoot/version.rb
|