bson 4.3.0.beta-java → 4.3.0-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/lib/bson-ruby.jar +0 -0
- data/lib/bson/array.rb +1 -1
- data/lib/bson/document.rb +20 -0
- data/lib/bson/string.rb +1 -1
- data/lib/bson/version.rb +1 -1
- data/spec/bson/document_spec.rb +23 -1
- data/spec/spec_helper.rb +0 -1
- metadata +45 -46
- metadata.gz.sig +0 -0
- data/lib/bson_native.bundle +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4db29f7f4d8980b8014e4682d1d5e983049ed64
|
4
|
+
data.tar.gz: ff3704ebf4dcf34ff0d1f1f28593d4246bc13711
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a12b26ecfaa22dc2d7bd753e15b3fc6e795743ba6dbff8e8f8771dcf47d5f5d7172c2a08e802ec390fd670bd85a0c450b8713bfc74a2322eac88d7413189d1c3
|
7
|
+
data.tar.gz: 6cd5df5fdab491856c246a3c4d7bb69739361c82c3485b783bb33184bb224f561ba9d5f5ec01bf895db51b31c26d425c5d51606a9b9907e67a6f6f2015e41341
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/bson-ruby.jar
CHANGED
Binary file
|
data/lib/bson/array.rb
CHANGED
@@ -64,7 +64,7 @@ module BSON
|
|
64
64
|
#
|
65
65
|
# @note This is used for repairing legacy bson data.
|
66
66
|
#
|
67
|
-
# @raise [
|
67
|
+
# @raise [ BSON::ObjectId::Invalid ] If the array is not 12 elements.
|
68
68
|
#
|
69
69
|
# @return [ String ] The raw object id bytes.
|
70
70
|
#
|
data/lib/bson/document.rb
CHANGED
@@ -172,6 +172,26 @@ module BSON
|
|
172
172
|
|
173
173
|
alias :update :merge!
|
174
174
|
|
175
|
+
if instance_methods.include?(:dig)
|
176
|
+
# Retrieves the value object corresponding to the each key objects repeatedly.
|
177
|
+
# Will normalize symbol keys into strings.
|
178
|
+
#
|
179
|
+
# @example Get value from nested sub-documents, handling missing levels.
|
180
|
+
# document # => { :key1 => { "key2" => "value"}}
|
181
|
+
# document.dig(:key1, :key2) # => "value"
|
182
|
+
# document.dig("key1", "key2") # => "value"
|
183
|
+
# document.dig("foo", "key2") # => nil
|
184
|
+
#
|
185
|
+
# @param [ Array<String, Symbol> ] *keys Keys, which constitute a "path" to the nested value.
|
186
|
+
#
|
187
|
+
# @return [ Object, NilClass ] The requested value or nil.
|
188
|
+
#
|
189
|
+
# @since 3.0.0
|
190
|
+
def dig(*keys)
|
191
|
+
super(*keys.map{|key| convert_key(key)})
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
175
195
|
private
|
176
196
|
|
177
197
|
def convert_key(key)
|
data/lib/bson/string.rb
CHANGED
@@ -79,7 +79,7 @@ module BSON
|
|
79
79
|
#
|
80
80
|
# @note This is used for repairing legacy bson data.
|
81
81
|
#
|
82
|
-
# @raise [
|
82
|
+
# @raise [ BSON::ObjectId::Invalid ] If the string is not 12 elements.
|
83
83
|
#
|
84
84
|
# @return [ String ] The raw object id bytes.
|
85
85
|
#
|
data/lib/bson/version.rb
CHANGED
data/spec/bson/document_spec.rb
CHANGED
@@ -96,6 +96,28 @@ describe BSON::Document do
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
if described_class.instance_methods.include?(:dig)
|
100
|
+
describe "#dig" do
|
101
|
+
let(:document) do
|
102
|
+
described_class.new("key1" => { :key2 => "value" })
|
103
|
+
end
|
104
|
+
|
105
|
+
context "when provided string keys" do
|
106
|
+
|
107
|
+
it "returns the value" do
|
108
|
+
expect(document.dig("key1", "key2")).to eq("value")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context "when provided symbol keys" do
|
113
|
+
|
114
|
+
it "returns the value" do
|
115
|
+
expect(document.dig(:key1, :key2)).to eq("value")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
99
121
|
describe "#delete" do
|
100
122
|
|
101
123
|
shared_examples_for "a document with deletable pairs" do
|
@@ -766,7 +788,7 @@ describe BSON::Document do
|
|
766
788
|
"#{35.to_bson}"+
|
767
789
|
"#{BSON::Document::BSON_TYPE}0#{BSON::NULL_BYTE}#{12.to_bson}#{BSON::Int32::BSON_TYPE}a#{BSON::NULL_BYTE}#{1.to_bson}#{BSON::NULL_BYTE}" +
|
768
790
|
"#{BSON::Document::BSON_TYPE}1#{BSON::NULL_BYTE}#{12.to_bson}#{BSON::Int32::BSON_TYPE}b#{BSON::NULL_BYTE}#{2.to_bson}#{BSON::NULL_BYTE}" +
|
769
|
-
"#{BSON::NULL_BYTE}" +
|
791
|
+
"#{BSON::NULL_BYTE}" +
|
770
792
|
"#{BSON::NULL_BYTE}"
|
771
793
|
end
|
772
794
|
|
data/spec/spec_helper.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.3.0
|
4
|
+
version: 4.3.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
UgLdYyyGANc+TOKLFmx0eAJlCljAurbX7ctO2XI0f1AUdEYSqGzut+datXK/9nwQ
|
35
35
|
FACf8zd11PEds/Opai2Qp4aOBgaxXhhFG357umy1vRs=
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date:
|
37
|
+
date: 2018-01-17 00:00:00.000000000 Z
|
38
38
|
dependencies: []
|
39
39
|
description: A full featured BSON specification implementation, in Ruby
|
40
40
|
email:
|
@@ -86,7 +86,6 @@ files:
|
|
86
86
|
- lib/bson/true_class.rb
|
87
87
|
- lib/bson/undefined.rb
|
88
88
|
- lib/bson/version.rb
|
89
|
-
- lib/bson_native.bundle
|
90
89
|
- spec/bson/array_spec.rb
|
91
90
|
- spec/bson/binary_spec.rb
|
92
91
|
- spec/bson/boolean_spec.rb
|
@@ -180,71 +179,71 @@ signing_key:
|
|
180
179
|
specification_version: 4
|
181
180
|
summary: Ruby Implementation of the BSON specification
|
182
181
|
test_files:
|
183
|
-
- spec/bson_spec.rb
|
184
182
|
- spec/spec_helper.rb
|
185
|
-
- spec/
|
186
|
-
- spec/bson/
|
187
|
-
- spec/bson/
|
188
|
-
- spec/bson/
|
183
|
+
- spec/bson_spec.rb
|
184
|
+
- spec/bson/regexp_spec.rb
|
185
|
+
- spec/bson/min_key_spec.rb
|
186
|
+
- spec/bson/time_spec.rb
|
187
|
+
- spec/bson/int32_spec.rb
|
189
188
|
- spec/bson/code_spec.rb
|
190
|
-
- spec/bson/code_with_scope_spec.rb
|
191
189
|
- spec/bson/config_spec.rb
|
190
|
+
- spec/bson/undefined_spec.rb
|
192
191
|
- spec/bson/corpus_spec.rb
|
192
|
+
- spec/bson/boolean_spec.rb
|
193
|
+
- spec/bson/object_spec.rb
|
194
|
+
- spec/bson/array_spec.rb
|
195
|
+
- spec/bson/hash_spec.rb
|
193
196
|
- spec/bson/date_spec.rb
|
197
|
+
- spec/bson/json_spec.rb
|
198
|
+
- spec/bson/int64_spec.rb
|
199
|
+
- spec/bson/registry_spec.rb
|
200
|
+
- spec/bson/raw_spec.rb
|
201
|
+
- spec/bson/binary_spec.rb
|
202
|
+
- spec/bson/max_key_spec.rb
|
203
|
+
- spec/bson/code_with_scope_spec.rb
|
194
204
|
- spec/bson/date_time_spec.rb
|
195
|
-
- spec/bson/decimal128_spec.rb
|
196
|
-
- spec/bson/document_spec.rb
|
197
205
|
- spec/bson/driver_bson_spec.rb
|
198
206
|
- spec/bson/false_class_spec.rb
|
199
|
-
- spec/bson/
|
200
|
-
- spec/bson/hash_spec.rb
|
201
|
-
- spec/bson/int32_spec.rb
|
202
|
-
- spec/bson/int64_spec.rb
|
203
|
-
- spec/bson/integer_spec.rb
|
204
|
-
- spec/bson/json_spec.rb
|
205
|
-
- spec/bson/max_key_spec.rb
|
206
|
-
- spec/bson/min_key_spec.rb
|
207
|
-
- spec/bson/nil_class_spec.rb
|
208
|
-
- spec/bson/object_id_spec.rb
|
209
|
-
- spec/bson/object_spec.rb
|
210
|
-
- spec/bson/open_struct_spec.rb
|
211
|
-
- spec/bson/raw_spec.rb
|
212
|
-
- spec/bson/regexp_spec.rb
|
213
|
-
- spec/bson/registry_spec.rb
|
207
|
+
- spec/bson/byte_buffer_spec.rb
|
214
208
|
- spec/bson/string_spec.rb
|
215
|
-
- spec/bson/
|
216
|
-
- spec/bson/time_spec.rb
|
209
|
+
- spec/bson/open_struct_spec.rb
|
217
210
|
- spec/bson/timestamp_spec.rb
|
211
|
+
- spec/bson/symbol_spec.rb
|
212
|
+
- spec/bson/decimal128_spec.rb
|
213
|
+
- spec/bson/integer_spec.rb
|
214
|
+
- spec/bson/document_spec.rb
|
215
|
+
- spec/bson/float_spec.rb
|
216
|
+
- spec/bson/nil_class_spec.rb
|
218
217
|
- spec/bson/true_class_spec.rb
|
219
|
-
- spec/bson/
|
220
|
-
- spec/support/common_driver.rb
|
218
|
+
- spec/bson/object_id_spec.rb
|
221
219
|
- spec/support/corpus.rb
|
222
220
|
- spec/support/shared_examples.rb
|
223
|
-
- spec/support/
|
221
|
+
- spec/support/common_driver.rb
|
222
|
+
- spec/support/corpus-tests/maxkey.json
|
224
223
|
- spec/support/corpus-tests/boolean.json
|
224
|
+
- spec/support/corpus-tests/oid.json
|
225
225
|
- spec/support/corpus-tests/code.json
|
226
|
+
- spec/support/corpus-tests/array.json
|
227
|
+
- spec/support/corpus-tests/double.json
|
226
228
|
- spec/support/corpus-tests/code_w_scope.json
|
229
|
+
- spec/support/corpus-tests/string.json
|
227
230
|
- spec/support/corpus-tests/document.json
|
228
|
-
- spec/support/corpus-tests/
|
231
|
+
- spec/support/corpus-tests/top.json
|
232
|
+
- spec/support/corpus-tests/null.json
|
229
233
|
- spec/support/corpus-tests/int32.json
|
230
|
-
- spec/support/corpus-tests/
|
234
|
+
- spec/support/corpus-tests/timestamp.json
|
231
235
|
- spec/support/corpus-tests/minkey.json
|
232
|
-
- spec/support/corpus-tests/null.json
|
233
|
-
- spec/support/corpus-tests/oid.json
|
234
236
|
- spec/support/corpus-tests/regex.json
|
235
|
-
- spec/support/corpus-tests/string.json
|
236
|
-
- spec/support/corpus-tests/timestamp.json
|
237
|
-
- spec/support/corpus-tests/top.json
|
238
|
-
- spec/support/corpus-tests/failures/binary.json
|
239
237
|
- spec/support/corpus-tests/failures/datetime.json
|
240
|
-
- spec/support/corpus-tests/failures/dbpointer.json
|
241
|
-
- spec/support/corpus-tests/failures/int64.json
|
242
238
|
- spec/support/corpus-tests/failures/symbol.json
|
239
|
+
- spec/support/corpus-tests/failures/int64.json
|
240
|
+
- spec/support/corpus-tests/failures/dbpointer.json
|
243
241
|
- spec/support/corpus-tests/failures/undefined.json
|
242
|
+
- spec/support/corpus-tests/failures/binary.json
|
244
243
|
- spec/support/driver-spec-tests/decimal128/decimal128-1.json
|
245
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-2.json
|
246
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-3.json
|
247
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-4.json
|
248
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-5.json
|
249
|
-
- spec/support/driver-spec-tests/decimal128/decimal128-6.json
|
250
244
|
- spec/support/driver-spec-tests/decimal128/decimal128-7.json
|
245
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-6.json
|
246
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-5.json
|
247
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-4.json
|
248
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-3.json
|
249
|
+
- spec/support/driver-spec-tests/decimal128/decimal128-2.json
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/bson_native.bundle
DELETED
Binary file
|