bson 3.1.2-java → 3.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ae5b3641c7aca31c8f6ac1af6c078db32957b27
4
- data.tar.gz: b80382974a1854ab3d3a634acb8bc1bab64e5b0f
3
+ metadata.gz: ffe178fd95f00fd40e6939901c3500102f60cc67
4
+ data.tar.gz: c7ffee83f85064e1a6e0eafa0f2d040875407c6d
5
5
  SHA512:
6
- metadata.gz: 1500ffe8c29d66b4cc6548878fd4ed493372e8af2524eb40db18593fa2c1954b6b2ace49ea2ae2c174f19d3db5eadcae006f2bb54679342793473fdd045e72d5
7
- data.tar.gz: 47a3318dd9cbdf17e529221b72b2c9236f1070c33bd1b6093ecad157fc0103cf3ca88be46b06ec22faaa3524a9911365a8d5de2c8037036d908647f39117b39d
6
+ metadata.gz: 8ce0bd27f43518077db60b25cc4009c721173aa3d43819a0ba5152cfa67e6cead5a11642d8cd0f12d6fe231c008cfeee40802ab9369a2a309f74d6353d66f348
7
+ data.tar.gz: 26a4d727425f8ae539cc7f26185be7704d79e062172be98b50de3c281dbf50ae6f1b8687f962c512c55f1ef8c90ff7a3b98d376961bd55c39213b7adada32a87
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  BSON Changelog
2
2
  ==============
3
3
 
4
+ ## 3.2.0
5
+
6
+ ### Bug Fixes
7
+
8
+ * [RUBY-950](https://jira.mongodb.org/browse/RUBY-950) Don't encode to UTF-8 in Binary#to_bson, only force BINARY encoding.
9
+
10
+ ### New features
11
+
12
+ * Add `BSON.ObjectId` constructor for instantiating an ObjectId from a String. Update ObjectId#inspect to print out a string that can be evaluated into the corresponding ObjectId. (Tony Ta)
13
+
4
14
  ## 3.1.2
5
15
 
6
16
  ### Bug Fixes
data/lib/bson-ruby.jar CHANGED
Binary file
data/lib/bson.rb CHANGED
@@ -19,6 +19,22 @@ require "bson/environment"
19
19
  # @since 0.0.0
20
20
  module BSON
21
21
 
22
+ # Create a new object id from a string using ObjectId.from_string
23
+ #
24
+ # @example Create an object id from the string.
25
+ # BSON::ObjectId(id)
26
+ #
27
+ # @param [ String ] string The string to create the id from.
28
+ #
29
+ # @raise [ BSON::ObjectId::Invalid ] If the provided string is invalid.
30
+ #
31
+ # @return [ BSON::ObjectId ] The new object id.
32
+ #
33
+ # @see ObjectId.from_string
34
+ def self.ObjectId(string)
35
+ self::ObjectId.from_string(string)
36
+ end
37
+
22
38
  # Constant for binary string encoding.
23
39
  #
24
40
  # @since 2.0.0
data/lib/bson/binary.rb CHANGED
@@ -134,7 +134,7 @@ module BSON
134
134
  encode_binary_data_with_placeholder(encoded) do |encoded|
135
135
  encoded << SUBTYPES.fetch(type)
136
136
  encoded << data.bytesize.to_bson if type == :old
137
- encoded << data.encode(UTF8).force_encoding(BINARY)
137
+ encoded << data.force_encoding(BINARY)
138
138
  end
139
139
  end
140
140
 
@@ -124,7 +124,7 @@ module BSON
124
124
  #
125
125
  # @since 2.0.0
126
126
  def inspect
127
- "<BSON::ObjectId:0x#{object_id} data=#{to_s}>"
127
+ "BSON::ObjectId('#{to_s}')"
128
128
  end
129
129
 
130
130
  # Dump the raw bson when calling Marshal.dump.
data/lib/bson/version.rb CHANGED
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "3.1.2"
16
+ VERSION = "3.2.0"
17
17
  end
@@ -390,7 +390,11 @@ describe BSON::ObjectId do
390
390
  end
391
391
 
392
392
  it "returns the inspection with the object id to_s" do
393
- expect(object_id.inspect).to eq("<BSON::ObjectId:0x#{object_id.object_id} data=#{object_id.to_s}>")
393
+ expect(object_id.inspect).to eq("BSON::ObjectId('#{object_id.to_s}')")
394
+ end
395
+
396
+ it "returns a string that evaluates into an equivalent object id" do
397
+ expect(eval object_id.inspect).to eq object_id
394
398
  end
395
399
  end
396
400
 
data/spec/bson_spec.rb CHANGED
@@ -16,6 +16,16 @@ require "spec_helper"
16
16
 
17
17
  describe BSON do
18
18
 
19
+ describe ".ObjectId" do
20
+
21
+ let(:string) { "4e4d66343b39b68407000001" }
22
+
23
+ it "returns an BSON::ObjectId from given string" do
24
+ expect(described_class::ObjectId(string)).to be_a BSON::ObjectId
25
+ expect(described_class::ObjectId(string)).to eq BSON::ObjectId.from_string(string)
26
+ end
27
+ end
28
+
19
29
  describe "::BINARY" do
20
30
 
21
31
  it "returns BINARY" 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: 3.1.2
4
+ version: 3.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Tyler Brock
@@ -34,7 +34,7 @@ cert_chain:
34
34
  XZOS48LlWh15EG4yZo/gRzqNAW2LUIkYA5eMS2Kp6r+KV8IBUO/LaHdrXbdilpa8
35
35
  BRsuCo7UZDbFVRns04HLyjVvkj+K/ywIcdKdS0csz5M=
36
36
  -----END CERTIFICATE-----
37
- date: 2015-07-01 00:00:00.000000000 Z
37
+ date: 2015-07-22 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