bson 3.0.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +11 -0
- data/lib/bson/binary.rb +1 -1
- data/lib/bson/regexp.rb +17 -0
- data/lib/bson/version.rb +1 -1
- data/spec/bson/binary_spec.rb +18 -1
- data/spec/bson/object_id_spec.rb +7 -0
- data/spec/bson/regexp_spec.rb +16 -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: 47f064976e34a90ffdc62d9b0f43264ada242462
|
4
|
+
data.tar.gz: 48151e4c94187076bfa4711c49059d501aa69d23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e5fa3e317570ec74882f92db96ed317bed5af33ead6fd7cc586f3c978a538a401c0e61019ba118e68ecd81835bc092e036776d85987982f0ff9e7674d4b8773
|
7
|
+
data.tar.gz: f6010bed96f29ff857e67145c4af598578757836d03a27370dbcf42ab2da0584b6cfcba5e3830707971813ee68be7fea6664755d215de6b9bf8f60dbf76ad598
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
BSON Changelog
|
2
2
|
==============
|
3
3
|
|
4
|
+
## 3.1.0
|
5
|
+
|
6
|
+
### New Features
|
7
|
+
|
8
|
+
* `BSON::Regexp::Raw` now behaves like a regular `Regexp` by delegating to the compiled and
|
9
|
+
wrapped regex. (Tom Scott)
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* Fixed `inspect` on `BSON::Binary` to handle ASCII characters. (Jérémy Carlier)
|
14
|
+
|
4
15
|
## 3.0.4
|
5
16
|
|
6
17
|
### Bug Fixes
|
data/lib/bson/binary.rb
CHANGED
@@ -117,7 +117,7 @@ module BSON
|
|
117
117
|
#
|
118
118
|
# @since 2.3.0
|
119
119
|
def inspect
|
120
|
-
"<BSON::Binary:0x#{object_id} type=#{type} data
|
120
|
+
"<BSON::Binary:0x#{object_id} type=#{type} data=0x#{data[0, 8].unpack('H*').first}...>"
|
121
121
|
end
|
122
122
|
|
123
123
|
# Encode the binary type
|
data/lib/bson/regexp.rb
CHANGED
@@ -120,6 +120,23 @@ module BSON
|
|
120
120
|
@pattern = pattern
|
121
121
|
@options = options
|
122
122
|
end
|
123
|
+
|
124
|
+
# Allow automatic delegation of methods to the Regexp object
|
125
|
+
# returned by +compile+.
|
126
|
+
#
|
127
|
+
# @param [ String] method The name of a method.
|
128
|
+
#
|
129
|
+
# @since 3.1.0
|
130
|
+
def respond_to?(method)
|
131
|
+
compile.respond_to?(method) || super
|
132
|
+
end
|
133
|
+
|
134
|
+
private
|
135
|
+
|
136
|
+
def method_missing(method, *arguments)
|
137
|
+
return super unless respond_to?(method)
|
138
|
+
compile.send(method)
|
139
|
+
end
|
123
140
|
end
|
124
141
|
|
125
142
|
module ClassMethods
|
data/lib/bson/version.rb
CHANGED
data/spec/bson/binary_spec.rb
CHANGED
@@ -91,8 +91,25 @@ describe BSON::Binary do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'returns the truncated data and type' do
|
94
|
-
expect(object.inspect).to eq("<BSON::Binary:0x#{object.object_id} type=user data=
|
94
|
+
expect(object.inspect).to eq("<BSON::Binary:0x#{object.object_id} type=user data=0x74657374696e6731...>")
|
95
95
|
end
|
96
|
+
|
97
|
+
context 'with other encoding' do
|
98
|
+
|
99
|
+
let(:object) do
|
100
|
+
described_class.new("\x1F\x8B\b\x00\fxpU\x00\x03\xED\x1C\xDBv\xDB6\xF2\xBD_\x81UN\x9A\xE6T\x96H\xDD-\xDBjR7\xDD\xA6mR\x9F:m\xB7".force_encoding(Encoding::BINARY), :user)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'returns the truncated data and type' do
|
104
|
+
expect(object.inspect).to eq("<BSON::Binary:0x#{object.object_id} type=user data=0x1f8b08000c787055...>")
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'is not different from default encoding' do
|
108
|
+
expect(object.inspect.encoding).not_to eq(Encoding::BINARY)
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
96
113
|
end
|
97
114
|
|
98
115
|
describe "#to_bson/#from_bson" do
|
data/spec/bson/object_id_spec.rb
CHANGED
@@ -417,6 +417,13 @@ describe BSON::ObjectId do
|
|
417
417
|
end
|
418
418
|
end
|
419
419
|
|
420
|
+
context "when the string contains newlines" do
|
421
|
+
|
422
|
+
it "returns false" do
|
423
|
+
expect(described_class).to_not be_legal("\n\n" + "a" * 24 + "\n\n")
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
420
427
|
context "when checking against another object id" do
|
421
428
|
|
422
429
|
let(:object_id) do
|
data/spec/bson/regexp_spec.rb
CHANGED
@@ -46,6 +46,22 @@ describe Regexp do
|
|
46
46
|
|
47
47
|
it_behaves_like "a bson element"
|
48
48
|
|
49
|
+
context "when calling normal regexp methods on a Regexp::Raw" do
|
50
|
+
let :obj do
|
51
|
+
/\d+/
|
52
|
+
end
|
53
|
+
|
54
|
+
let :bson do
|
55
|
+
[obj.source, BSON::NULL_BYTE, BSON::NULL_BYTE].join ''
|
56
|
+
end
|
57
|
+
|
58
|
+
it_behaves_like "a serializable bson element"
|
59
|
+
|
60
|
+
it "runs the method on the Regexp object" do
|
61
|
+
expect(result.match('6')).not_to be_nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
49
65
|
context "when the regexp has no options" do
|
50
66
|
|
51
67
|
let(:obj) { /\d+/ }
|
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.0
|
4
|
+
version: 3.1.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-06-
|
37
|
+
date: 2015-06-11 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
|