bson 4.0.3 → 4.0.4
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 +2 -1
- data.tar.gz.sig +1 -2
- data/README.md +1 -1
- data/lib/bson/hash.rb +1 -1
- data/lib/bson/regexp.rb +2 -2
- data/lib/bson/registry.rb +18 -2
- data/lib/bson/version.rb +1 -1
- data/spec/bson/object_id_spec.rb +1 -1
- data/spec/bson/registry_spec.rb +5 -3
- data/spec/bson/string_spec.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 102b6e1ecbcea8594a6bec1c1f0f80f0ad33186a
|
4
|
+
data.tar.gz: 7d21bbdc3197fbf22feed60d9dac7960def90c55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16772cdfb99cfd32022abba1a63d763d3b0e8da6a77825b25aebace05f73e31455a723db12e6738e64c7a711ffe34d5b9005c6eac65c8adca00c696d7b7c2e1b
|
7
|
+
data.tar.gz: a21557e5e8080c90ae8869115c5a199617ca34a0aec7d06b74ce137e32bd128a65aaa58dc4b1a4a158f3de85e08cea2d6db392d6dd8dd8fc4c45052929ed3281
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
�!�*��nw�Ʌ�>nl�eRd�JN��K º��+���Y��K��Q�b��4f{��e�w^�V!K�)�&l�8>&!q��9�%}8Z����~��Z����U��n��Y�7H�Z~iA����8>���s��;��C�8����F�QKZDon�~Ch<����9
|
2
|
+
��`�Nfė��W�i�`r����
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
��
|
2
|
-
������}��0����z��4t%�/���� �QE��Zt`R�����L�wzl��bk<M��n����ª�6�pH�D�[A�Ϋ�iV2_K��̎3PXNn%�f��GB0�Ih�W ���U���I�H=�,�좲յG{m�c���%��5A��"9�dpe�fȭ���2n9ڷ�^EN�4�������7�����z9n�pW����c2��В'��O��ٔt��ߌ��?��4������*Fh
|
1
|
+
~ڶ�[�C�,���T�kS9���(��0�SY��Tz.APc4@�8*���yt�$��=kВr��nГ��}ϴ���*'�*��]�k�~&,[����T<@-��v�N�i<�fb�?zA"Lo\�}[;g;h�b�;��ȱ��
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ As of 2.0.0, this project adheres to the [Semantic Versioning Specification](htt
|
|
32
32
|
License
|
33
33
|
-------
|
34
34
|
|
35
|
-
Copyright (C) 2009-
|
35
|
+
Copyright (C) 2009-2016 MongoDB Inc.
|
36
36
|
|
37
37
|
Licensed under the Apache License, Version 2.0 (the "License");
|
38
38
|
you may not use this file except in compliance with the License.
|
data/lib/bson/hash.rb
CHANGED
@@ -77,7 +77,7 @@ module BSON
|
|
77
77
|
buffer.get_int32 # Throw away the size.
|
78
78
|
while (type = buffer.get_byte) != NULL_BYTE
|
79
79
|
field = buffer.get_cstring
|
80
|
-
hash.store(field, BSON::Registry.get(type).from_bson(buffer))
|
80
|
+
hash.store(field, BSON::Registry.get(type, field).from_bson(buffer))
|
81
81
|
end
|
82
82
|
hash
|
83
83
|
end
|
data/lib/bson/regexp.rb
CHANGED
@@ -152,8 +152,8 @@ module BSON
|
|
152
152
|
# @param [ String] method The name of a method.
|
153
153
|
#
|
154
154
|
# @since 3.1.0
|
155
|
-
def respond_to?(method)
|
156
|
-
compile.respond_to?(method) || super
|
155
|
+
def respond_to?(method, include_private = false)
|
156
|
+
compile.respond_to?(method, include_private = false) || super
|
157
157
|
end
|
158
158
|
|
159
159
|
private
|
data/lib/bson/registry.rb
CHANGED
@@ -39,8 +39,12 @@ module BSON
|
|
39
39
|
# @see http://bsonspec.org/#/specification
|
40
40
|
#
|
41
41
|
# @since 2.0.0
|
42
|
-
def get(byte)
|
43
|
-
MAPPINGS[byte]
|
42
|
+
def get(byte, field = nil)
|
43
|
+
if type = MAPPINGS[byte]
|
44
|
+
type
|
45
|
+
else
|
46
|
+
handle_unsupported_type!(byte, field)
|
47
|
+
end
|
44
48
|
end
|
45
49
|
|
46
50
|
# Register the Ruby type for the corresponding single byte.
|
@@ -59,6 +63,11 @@ module BSON
|
|
59
63
|
define_type_reader(type)
|
60
64
|
end
|
61
65
|
|
66
|
+
# Raised when trying to get a type from the registry that doesn't exist.
|
67
|
+
#
|
68
|
+
# @since 4.1.0
|
69
|
+
class UnsupportedType < RuntimeError; end
|
70
|
+
|
62
71
|
private
|
63
72
|
|
64
73
|
def define_type_reader(type)
|
@@ -66,5 +75,12 @@ module BSON
|
|
66
75
|
def bson_type; BSON_TYPE; end
|
67
76
|
MOD
|
68
77
|
end
|
78
|
+
|
79
|
+
def handle_unsupported_type!(byte, field)
|
80
|
+
message = "Detected unknown BSON type #{byte.inspect} "
|
81
|
+
message += (field ? "for fieldname \"#{field}\". " : "in array. ")
|
82
|
+
message +="Are you using the latest BSON version?"
|
83
|
+
raise UnsupportedType.new(message)
|
84
|
+
end
|
69
85
|
end
|
70
86
|
end
|
data/lib/bson/version.rb
CHANGED
data/spec/bson/object_id_spec.rb
CHANGED
data/spec/bson/registry_spec.rb
CHANGED
@@ -25,7 +25,7 @@ describe BSON::Registry do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
let(:klass) do
|
28
|
-
described_class.get(BSON::MinKey::BSON_TYPE)
|
28
|
+
described_class.get(BSON::MinKey::BSON_TYPE, "field")
|
29
29
|
end
|
30
30
|
|
31
31
|
it "returns the class" do
|
@@ -35,8 +35,10 @@ describe BSON::Registry do
|
|
35
35
|
|
36
36
|
context "when the type has no corresponding class" do
|
37
37
|
|
38
|
-
it "
|
39
|
-
expect
|
38
|
+
it "raises an error" do
|
39
|
+
expect {
|
40
|
+
described_class.get(25.chr, "field")
|
41
|
+
}.to raise_error(BSON::Registry::UnsupportedType)
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
data/spec/bson/string_spec.rb
CHANGED
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: 4.0.
|
4
|
+
version: 4.0.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: 2016-
|
37
|
+
date: 2016-03-06 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
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�
|
2
|
+
2�N��ؿ��W���'$�D�.����k��o�8�ӱ����J���'����
|