bson 2.2.1-java → 2.2.2-java

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd3d7afd651d161d6a2de97fe9982b8972faada8
4
- data.tar.gz: 9c9578ef230b8b24d6b671704c9926866361b162
3
+ metadata.gz: e407939a4b8e13a960f15fc9d8910df10fa7f27b
4
+ data.tar.gz: df201aaf41b3bb467851b7c4c41633371573807b
5
5
  SHA512:
6
- metadata.gz: 685e4965524a8f83524df4553625e19e4815c501182d759f968ac74f3ab2c65061be290700530d577510f2de714a403899088276d84c7938a26b73b9d133250b
7
- data.tar.gz: 91df04208f8f84a5bc8d06f1229bbd5cc0050af98b36f60c110b68c41f4a19477b8c00d08464efbd5ab585ed6a6d964ab23bb1b7f7f584a9403de57b73ed1bed
6
+ metadata.gz: 8c702264504931eb1845ad07d10a64db8f07bc7a29caa61cc6c64b52bf5f69ce6d1dfb15403aafc684a5f5d1c6e623f2ee51f74db5143122acbe4bdac5368345
7
+ data.tar.gz: d546e6a01357b0271e598b05f8adc397443734855e74a37cf3bc85a24cf111d09765ab1880d04a1549085e13a217bb31455c1a25096c0e992e35fb063393196e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,6 +1,18 @@
1
1
  BSON Changelog
2
2
  ==============
3
3
 
4
+ ## 2.2.2
5
+
6
+ ### Bug Fixes
7
+
8
+ * [#17](http://github.com/mongodb/bson-ruby/pull/17):
9
+ Fixed `BSON::ObjectId` counter increment on Ruby 2.1.0 since method names
10
+ can no longer override Ruby keywords.
11
+
12
+ * [#16](http://github.com/mongodb/bson-ruby/pull/16):
13
+ Fixed serialization of times when microseconds are causing `to_f` on time to
14
+ be 1 microsecond inaccurate. (Francois Bernier)
15
+
4
16
  ## 2.2.1
5
17
 
6
18
  ### Bug Fixes
Binary file
@@ -170,7 +170,7 @@ module BSON
170
170
  # @since 2.0.0
171
171
  def to_bson(encoded = ''.force_encoding(BINARY))
172
172
  repair if defined?(@data)
173
- @raw_data ||= @@generator.next
173
+ @raw_data ||= @@generator.next_object_id
174
174
  encoded << @raw_data
175
175
  end
176
176
 
@@ -268,7 +268,7 @@ module BSON
268
268
  #
269
269
  # @since 2.0.0
270
270
  def from_time(time, options = {})
271
- from_data(options[:unique] ? @@generator.next(time.to_i) : [ time.to_i ].pack("Nx8"))
271
+ from_data(options[:unique] ? @@generator.next_object_id(time.to_i) : [ time.to_i ].pack("Nx8"))
272
272
  end
273
273
 
274
274
  # Determine if the provided string is a legal object id.
@@ -337,14 +337,14 @@ module BSON
337
337
  # object id counter. Will use the provided time if not nil.
338
338
  #
339
339
  # @example Get the next object id data.
340
- # generator.next
340
+ # generator.next_object_id
341
341
  #
342
342
  # @param [ Time ] time The optional time to generate with.
343
343
  #
344
344
  # @return [ String ] The raw object id bytes.
345
345
  #
346
346
  # @since 2.0.0
347
- def next(time = nil)
347
+ def next_object_id(time = nil)
348
348
  @mutex.lock
349
349
  begin
350
350
  count = @counter = (@counter + 1) % 0xFFFFFF
@@ -38,7 +38,7 @@ module BSON
38
38
  #
39
39
  # @since 2.0.0
40
40
  def to_bson(encoded = ''.force_encoding(BINARY))
41
- encoded << [ (to_f * 1000.0).to_i ].pack(Int64::PACK)
41
+ encoded << [ (to_i * 1000) + (usec / 1000) ].pack(Int64::PACK)
42
42
  end
43
43
 
44
44
  module ClassMethods
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "2.2.1"
16
+ VERSION = "2.2.2"
17
17
  end
@@ -24,11 +24,23 @@ describe Time do
24
24
 
25
25
  context "when the time is post epoch" do
26
26
 
27
- let(:obj) { Time.utc(2012, 1, 1, 0, 0, 0) }
28
- let(:bson) { [ (obj.to_f * 1000).to_i ].pack(BSON::Int64::PACK) }
27
+ context "when the time has no microseconds" do
29
28
 
30
- it_behaves_like "a serializable bson element"
31
- it_behaves_like "a deserializable bson element"
29
+ let(:obj) { Time.utc(2012, 1, 1, 0, 0, 0) }
30
+ let(:bson) { [ (obj.to_i * 1000) + (obj.usec / 1000) ].pack(BSON::Int64::PACK) }
31
+
32
+ it_behaves_like "a serializable bson element"
33
+ it_behaves_like "a deserializable bson element"
34
+ end
35
+
36
+ context "when the time has microseconds" do
37
+
38
+ let(:obj) { Time.at(Time.utc(2014, 03, 22, 18, 05, 05).to_i, 505000).utc }
39
+ let(:bson) { [ (obj.to_i * 1000) + (obj.usec / 1000) ].pack(BSON::Int64::PACK) }
40
+
41
+ it_behaves_like "a serializable bson element"
42
+ it_behaves_like "a deserializable bson element"
43
+ end
32
44
  end
33
45
 
34
46
  context "when the time is pre epoch" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: java
6
6
  authors:
7
7
  - Tyler Brock
@@ -34,7 +34,7 @@ cert_chain:
34
34
  JrZM8w8wGbIOeLtoQqa7HB/jOYbTahH7KMNh2LHAbOR93hNIJxVRa4iwxiMQ75tN
35
35
  9WUIAJ4AEtjwRg1Bz0OwDo3aucPCBpx77+/FWhv7JYY=
36
36
  -----END CERTIFICATE-----
37
- date: 2014-02-19 00:00:00.000000000 Z
37
+ date: 2014-04-03 00:00:00.000000000 Z
38
38
  dependencies: []
39
39
  description: A full featured BSON specification implementation, in Ruby
40
40
  email:
metadata.gz.sig CHANGED
Binary file