bson 3.1.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +10 -0
- data/lib/bson.rb +16 -0
- data/lib/bson/binary.rb +1 -1
- data/lib/bson/object_id.rb +1 -1
- data/lib/bson/version.rb +1 -1
- data/spec/bson/object_id_spec.rb +5 -1
- data/spec/bson_spec.rb +10 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 830d8156be21a282cce7f2ff5c7136c7c0cf5320
|
4
|
+
data.tar.gz: 1003e647f5ff7789f861838b4d7c4080237556c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1acb711445290f976f2754dbc20903f583f1f4c96efd993eb7982ace58742ebe96d0d243f35bb3c2b50e1cdfb7714065f14b2ff4ef5b75afd46c0de5eb52b9f
|
7
|
+
data.tar.gz: c3b549ae774b91c4af91dafca71ab78d47154c56871163cd4e31c7640f90c5557956ccae84843b85b59df13041977a96868a7cddea2f508639a5b70a921bcf34
|
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.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.
|
137
|
+
encoded << data.force_encoding(BINARY)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
data/lib/bson/object_id.rb
CHANGED
data/lib/bson/version.rb
CHANGED
data/spec/bson/object_id_spec.rb
CHANGED
@@ -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("
|
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.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
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-
|
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
|