bson 4.0.3-java → 4.0.4-java
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/README.md +1 -1
- data/lib/bson-ruby.jar +0 -0
- 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 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2acb70e11a8426afd8b5b1269f34f4bd0fe73b2e
|
4
|
+
data.tar.gz: d62bbc6fb021e6a275e6a3853ad7bbee770dff06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 315abfefcae86c1c3924c04d89aef67a07bc043a53c5d2fb2bd1e30b0e02d3be6d1edb12430b6790ff6eceea117332688e4a6d7b67fdf8db70e263598f624ee6
|
7
|
+
data.tar.gz: f556ff6be0e50c33f6525f9ce5992f50a188aedcb76fcd38c4a2584b8eb37bad9f185c306e21af99a1320f9549f59786baa9829f1ec0052a09a35c5e5d14deaa
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
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-ruby.jar
CHANGED
Binary file
|
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: 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: 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
Binary file
|