bson 0.20.1 → 1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bson might be problematic. Click here for more details.

@@ -1,7 +1,7 @@
1
1
  $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
 
3
3
  module BSON
4
- VERSION = "0.20.1"
4
+ VERSION = "1.0"
5
5
  def self.serialize(obj, check_keys=false, move_id=false)
6
6
  BSON_CODER.serialize(obj, check_keys, move_id)
7
7
  end
@@ -116,7 +116,7 @@ module BSON
116
116
  raise InvalidDocument, "Document is too large (#{@buf.size}). BSON documents are limited to 4MB (#{4 * 1024 * 1024})."
117
117
  end
118
118
  @buf.put_int(@buf.size, 0)
119
- self
119
+ @buf
120
120
  end
121
121
 
122
122
  # Returns the array stored in the buffer.
@@ -127,7 +127,7 @@ module BSON
127
127
  end
128
128
 
129
129
  def inspect
130
- "ObjectID('#{to_s}')"
130
+ {"$oid" => to_s}
131
131
  end
132
132
 
133
133
  # Convert to MongoDB extended JSON format. Since JSON includes type information,
@@ -22,6 +22,12 @@ class BSONTest < Test::Unit::TestCase
22
22
 
23
23
  include BSON
24
24
 
25
+ def test_serialize_returns_byte_buffer
26
+ doc = {'doc' => 'hello, world'}
27
+ bson = BSON.serialize(doc)
28
+ assert bson.is_a?(ByteBuffer)
29
+ end
30
+
25
31
  def test_deprecated_bson_module
26
32
  doc = {'doc' => 'hello, world'}
27
33
  bson = BSON.serialize(doc)
@@ -50,7 +50,8 @@ class ObjectIDTest < Test::Unit::TestCase
50
50
  end
51
51
 
52
52
  def test_inspect
53
- assert_equal "ObjectID('#{@o.to_s}')", @o.inspect
53
+ obj = {'$oid' => @o.to_s}
54
+ assert_equal obj, @o.inspect
54
55
  end
55
56
 
56
57
  def test_save_and_restore
metadata CHANGED
@@ -3,10 +3,9 @@ name: bson
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
- - 0
7
- - 20
8
6
  - 1
9
- version: 0.20.1
7
+ - 0
8
+ version: "1.0"
10
9
  platform: ruby
11
10
  authors:
12
11
  - Jim Menard
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-04-07 00:00:00 -04:00
18
+ date: 2010-04-29 00:00:00 -04:00
20
19
  default_executable:
21
20
  dependencies: []
22
21