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.
@@ -0,0 +1,7 @@
1
+ # As it turns out, serializing Time is something we should support for
2
+ # this sort of application
3
+ class Time
4
+ def to_msgpack(out='')
5
+ {"__type__" => "unixts", "ts" => self.to_i}.to_msgpack(out)
6
+ end
7
+ end
@@ -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
- MessagePack::Unpacker.new(file).each do |key, retval|
35
- c = hash
36
- key.each do |x|
37
- c[x] ||= SavePointHash.new
38
- c = c[x]
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
- c.complete = true
41
- c.ret_val = retval
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
@@ -1,3 +1,3 @@
1
1
  module Bandicoot
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 0
9
8
  - 1
10
- version: 0.0.1
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-15 00:00:00 -04:00
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