bson 3.2.3 → 3.2.4

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: a83a6cb4625e37db0fafa80ce5f1fd2338d1f0d4
4
- data.tar.gz: ea378315e221bd9c80b19038e93caaa4126fa256
3
+ metadata.gz: 3dc5021cec13fb522184eff22fbc21da999e4e00
4
+ data.tar.gz: 1af593ca4fa28815a0c73fa9caed09a8e77ac898
5
5
  SHA512:
6
- metadata.gz: beec93611bb46e76ce16d45a728f13325499e5ee1713dc28adfccf6d4ca95c5ab8526911ca208ed50a7e92c4266796063dc94e483870ff5ee9aa0a2b935efc3a
7
- data.tar.gz: 54f768da04f510ddc6cdda7ec2e0d5f7efd5b032249089f02e3cbc7694ba69a765e4dcfba6cc4171b8185ce023c58637bcb9ca316800b5099ffeac385310ac1d
6
+ metadata.gz: 98b53c5f9e1b5528507698be9cd6119d61a454be7400dbae4e1289944bb46d6d6732c6caf4c3adb14655ebd8a872da66841019b276865070e80a596b5ccb56e8
7
+ data.tar.gz: 080fde6e480edee7b400e2cfcad9a5363a33c4c75df0aff7e8883427cd8a32d2bb7cfa4e08ff3314bf2b2f01607a6f03bef8c284d1bd5325007d16c5075313ce
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  BSON Changelog
2
2
  ==============
3
3
 
4
+ ## 3.2.4
5
+
6
+ ### Bug Fixes
7
+
8
+ * [RUBY-1019](https://jira.mongodb.org/browse/RUBY-1019) Performace improvements on deserialization.
9
+
4
10
  ## 3.2.3
5
11
 
6
12
  ### Bug Fixes
@@ -9,8 +15,6 @@ BSON Changelog
9
15
 
10
16
  * [#40](https://github.com/mongodb/bson-ruby/pull/40) Added big endian support. (Jeff Blight)
11
17
 
12
- * [RUBY-1019](https://jira.mongodb.org/browse/RUBY-1019) Performace improvements on deserialization.
13
-
14
18
  ## 3.2.1
15
19
 
16
20
  ### Bug Fixes
data/lib/bson/hash.rb CHANGED
@@ -72,11 +72,11 @@ module BSON
72
72
  #
73
73
  # @since 2.0.0
74
74
  def from_bson(bson)
75
- hash = new
75
+ hash = Document.allocate
76
76
  bson.read(4) # Swallow the first four bytes.
77
77
  while (type = bson.readbyte.chr) != NULL_BYTE
78
78
  field = bson.gets(NULL_BYTE).from_bson_string.chop!
79
- hash[field] = BSON::Registry.get(type).from_bson(bson)
79
+ hash.store(field, BSON::Registry.get(type).from_bson(bson))
80
80
  end
81
81
  hash
82
82
  end
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.2.3"
16
+ VERSION = "3.2.4"
17
17
  end
@@ -626,6 +626,40 @@ describe BSON::Document do
626
626
  end
627
627
  end
628
628
 
629
+ describe "#from_bson" do
630
+
631
+ context "when the document has embedded documents in an array" do
632
+
633
+ let(:embedded_document) do
634
+ BSON::Document.new(n: 1)
635
+ end
636
+
637
+ let(:embedded_documents) do
638
+ [ embedded_document ]
639
+ end
640
+
641
+ let(:document) do
642
+ BSON::Document.new(field: 'value', embedded: embedded_documents)
643
+ end
644
+
645
+ let(:serialized) do
646
+ document.to_bson
647
+ end
648
+
649
+ let(:deserialized) do
650
+ described_class.from_bson(StringIO.new(serialized))
651
+ end
652
+
653
+ it 'deserializes the documents' do
654
+ expect(deserialized).to eq(document)
655
+ end
656
+
657
+ it 'deserializes embedded documents as document type' do
658
+ expect(deserialized[:embedded].first).to be_a(BSON::Document)
659
+ end
660
+ end
661
+ end
662
+
629
663
  describe "#to_bson/#from_bson" do
630
664
 
631
665
  let(:type) { 3.chr }
data.tar.gz.sig CHANGED
Binary file
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.2.3
4
+ version: 3.2.4
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-09-03 00:00:00.000000000 Z
37
+ date: 2015-09-04 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