bson 1.0.5 → 1.0.6
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.
- data/lib/bson.rb +2 -2
- data/lib/bson/ordered_hash.rb +4 -1
- data/test/mongo_bson/bson_test.rb +18 -17
- data/test/mongo_bson/ordered_hash_test.rb +7 -0
- metadata +4 -4
data/lib/bson.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
4
|
|
5
|
-
MINIMUM_BSON_EXT_VERSION = "1.0.
|
5
|
+
MINIMUM_BSON_EXT_VERSION = "1.0.6"
|
6
6
|
|
7
7
|
module BSON
|
8
|
-
VERSION = "1.0.
|
8
|
+
VERSION = "1.0.6"
|
9
9
|
def self.serialize(obj, check_keys=false, move_id=false)
|
10
10
|
BSON_CODER.serialize(obj, check_keys, move_id)
|
11
11
|
end
|
data/lib/bson/ordered_hash.rb
CHANGED
@@ -88,7 +88,7 @@ module BSON
|
|
88
88
|
@ordered_keys ||= []
|
89
89
|
@ordered_keys.map { |k| [k, self[k]] }
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
def values
|
93
93
|
collect { |k, v| v }
|
94
94
|
end
|
@@ -158,6 +158,9 @@ module BSON
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
+
def clone
|
162
|
+
Marshal::load(Marshal.dump(self))
|
163
|
+
end
|
161
164
|
end
|
162
165
|
end
|
163
166
|
end
|
@@ -6,11 +6,10 @@ require 'rational'
|
|
6
6
|
|
7
7
|
begin
|
8
8
|
require 'active_support/core_ext'
|
9
|
-
require 'active_support/hash_with_indifferent_access'
|
10
9
|
Time.zone = "Pacific Time (US & Canada)"
|
11
10
|
Zone = Time.zone.now
|
12
11
|
rescue LoadError
|
13
|
-
warn '
|
12
|
+
warn 'Mocking time with zone'
|
14
13
|
module ActiveSupport
|
15
14
|
class TimeWithZone
|
16
15
|
end
|
@@ -523,20 +522,22 @@ class BSONTest < Test::Unit::TestCase
|
|
523
522
|
BSON::BSON_CODER.serialize(c, false, false).to_s
|
524
523
|
end
|
525
524
|
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
525
|
+
# Mocking this class for testing
|
526
|
+
class ::HashWithIndifferentAccess < Hash; end
|
527
|
+
|
528
|
+
def test_keep_id_with_hash_with_indifferent_access
|
529
|
+
doc = HashWithIndifferentAccess.new
|
530
|
+
embedded = HashWithIndifferentAccess.new
|
531
|
+
embedded['_id'] = ObjectID.new
|
532
|
+
doc['_id'] = ObjectID.new
|
533
|
+
doc['embedded'] = [embedded]
|
534
|
+
BSON::BSON_CODER.serialize(doc, false, true).to_a
|
535
|
+
assert doc.has_key?("_id")
|
536
|
+
assert doc['embedded'][0].has_key?("_id")
|
537
|
+
|
538
|
+
doc['_id'] = ObjectID.new
|
539
|
+
BSON::BSON_CODER.serialize(doc, false, true).to_a
|
540
|
+
assert doc.has_key?("_id")
|
541
541
|
end
|
542
|
+
|
542
543
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 6
|
10
|
+
version: 1.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jim Menard
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-08-
|
20
|
+
date: 2010-08-28 00:00:00 -04:00
|
21
21
|
default_executable:
|
22
22
|
dependencies: []
|
23
23
|
|