bin 0.6 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/bin/store.rb CHANGED
@@ -15,7 +15,7 @@ module Bin
15
15
  super do
16
16
  expires = Time.now.utc + ((options && options[:expires_in]) || expires_in)
17
17
  raw = !!options[:raw]
18
- value = raw ? value : Marshal.dump(value)
18
+ value = raw ? value : BSON::Binary.new(Marshal.dump(value))
19
19
  doc = {:_id => key, :value => value, :expires_at => expires, :raw => raw}
20
20
  collection.save(doc)
21
21
  end
@@ -24,7 +24,7 @@ module Bin
24
24
  def read(key, options=nil)
25
25
  super do
26
26
  if doc = collection.find_one(:_id => key, :expires_at => {'$gt' => Time.now.utc})
27
- doc['raw'] ? doc['value'] : Marshal.load(doc['value'])
27
+ doc['raw'] ? doc['value'] : Marshal.load(doc['value'].to_s)
28
28
  end
29
29
  end
30
30
  end
data/lib/bin/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module Bin
3
- Version = '0.6'
3
+ Version = '0.6.1'
4
4
  end
@@ -41,7 +41,7 @@ describe Bin::Store do
41
41
  end
42
42
 
43
43
  it "should marshal value by default" do
44
- document['value'].should == Marshal.dump('bar')
44
+ document['value'].to_s.should == BSON::Binary.new(Marshal.dump('bar')).to_s
45
45
  document['raw'].should be_false
46
46
  end
47
47
 
metadata CHANGED
@@ -5,7 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- version: "0.6"
8
+ - 1
9
+ version: 0.6.1
9
10
  platform: ruby
10
11
  authors:
11
12
  - John Nunemaker