bson 3.0.4-java → 3.1.0-java

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: e15a83a3228aabbbe0ba970b02766a67ce81d422
4
- data.tar.gz: a57404f1c8ada4b0473cd877d2c0b0a6dd73c3f6
3
+ metadata.gz: 7c4d3274a71610f319ef7e1b0cb48e1cdfaef262
4
+ data.tar.gz: 9bb3b68125bdc55caa633e202ec43c510e020955
5
5
  SHA512:
6
- metadata.gz: 3c2aaf5896819ad43dca99fe7ec16ac1a09e33e4a7749c37e1c016a67f0dca80b9121c606e50c1985867c2869b228c1bfd5ce776143aceb46d1b163b95f7e1c4
7
- data.tar.gz: 270b657d4d7e0e3842fdf2e1bbfbd25afc36301d5ded2551941eb430ace247b1f2109c7c586d0a741410195c3cfd2e75ca63540fd40e6b7c9c01e681ce24b31a
6
+ metadata.gz: 9b099548252a4939b3449aa38f28063c25df21e3ffa9aab273d4e24e22dbbaec0790863eff78e59fab4b62d96f7e82e99afef7fb6c68f9b8e0617d99ed8f8ab1
7
+ data.tar.gz: 55d34df5d46136ffea946cd6fae2518db7ecdbc9517fad6daa77461d6e7ad28bf43a117ffc810e3840f53c9300517a3e22e94871b8ce48fd6512286805446c81
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
Binary file
@@ -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=#{data[0, 8]}...>"
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
@@ -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
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "3.0.4"
16
+ VERSION = "3.1.0"
17
17
  end
@@ -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=testing1...>")
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
@@ -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
@@ -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
4
+ version: 3.1.0
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: 2015-06-04 00:00:00.000000000 Z
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