bson 2.0.0.rc → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bson might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51d0ffbb27a8a61c61ddb11362bedefc925bb93b
4
- data.tar.gz: 704a6ba96297053bca1ca64bf4c3955636e3dda1
3
+ metadata.gz: da650cd5a81e6fbf7d40be183308904d83359e54
4
+ data.tar.gz: 1aa6c7977bbe2b62fb957d7f8435db70350407f6
5
5
  SHA512:
6
- metadata.gz: da4ee6399c526058ab0448f91e9bac86d8ff1a239e080e4d4f1357689919e5056c987ead50f45b59aa2e7cff7fe5bea52479e6f94021d46729e9512297f51050
7
- data.tar.gz: f3e9bd53a3bb5d43b0f07615c0a63b1aef057876fc319e50f8f584fddee3cd08ad3ebb522f3fb19cd69373df0e4fcc88af202fe8250035eaa673e5bd5a663aa5
6
+ metadata.gz: fd716b5ca171488c93c5d807d501684f31c23fd495466851fdead27a0a2b8c307856c8a014ad52923552792b3068bb65c5da08a2dbaa9089df1d95a7a3edba5d
7
+ data.tar.gz: 2c6086856793c542f66d7394885a7620b434f334f995c644298aa367d4f9af5b5ff87f17cb7ee24494e52052afff0ea3ea3d51f780d44f75a21ebc4b3685df04
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Rakefile CHANGED
@@ -56,16 +56,22 @@ end
56
56
  RSpec::Core::RakeTask.new(:spec)
57
57
  RSpec::Core::RakeTask.new(:rspec)
58
58
 
59
- task :build => :clean_all do
60
- system "gem build bson.gemspec"
59
+ if jruby?
60
+ task :build => [ :clean_all, :compile ] do
61
+ system "gem build bson.gemspec"
62
+ end
63
+ else
64
+ task :build => :clean_all do
65
+ system "gem build bson.gemspec"
66
+ end
61
67
  end
62
68
 
63
69
  task :clean_all => :clean do
64
70
  begin
65
- Dir.chdir(Pathname(__FILE__).dirname + "lib/bson") do
71
+ Dir.chdir(Pathname(__FILE__).dirname + "lib") do
66
72
  `rm native.#{extension}`
67
73
  `rm native.o`
68
- `rm native.jar`
74
+ `rm bson-ruby.jar`
69
75
  end
70
76
  rescue Exception => e
71
77
  puts e.message
@@ -15,10 +15,12 @@
15
15
  */
16
16
 
17
17
  #include <arpa/inet.h>
18
- #include <ruby.h>
19
18
  #include <stdint.h>
19
+ #include <sys/time.h>
20
+ #include <sys/types.h>
20
21
  #include <time.h>
21
22
  #include <unistd.h>
23
+ #include <ruby.h>
22
24
 
23
25
  /**
24
26
  * For 64 byte systems we convert to longs, for 32 byte systems we convert
@@ -82,6 +84,11 @@ static VALUE rb_bson_binary;
82
84
  */
83
85
  static VALUE rb_bson_utf8_string;
84
86
 
87
+ /**
88
+ * Set the UTC string method for reference at load.
89
+ *
90
+ * @since 2.0.0
91
+ */
85
92
  static VALUE rb_utc_method;
86
93
 
87
94
  /**
@@ -12,8 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require "json"
16
-
17
15
  module BSON
18
16
 
19
17
  # Provides common behaviour for JSON serialization of objects.
@@ -46,6 +46,7 @@ module BSON
46
46
  return false unless other.is_a?(ObjectId)
47
47
  to_bson == other.to_bson
48
48
  end
49
+ alias :eql? :==
49
50
 
50
51
  # Check case equality on the object id.
51
52
  #
@@ -102,6 +103,18 @@ module BSON
102
103
  ::Time.at(to_bson.unpack("N")[0]).utc
103
104
  end
104
105
 
106
+ # Get the hash value for the object id.
107
+ #
108
+ # @example Get the hash value.
109
+ # object_id.hash
110
+ #
111
+ # @return [ Integer ] The hash value.
112
+ #
113
+ # @since 2.0.0
114
+ def hash
115
+ to_bson.hash
116
+ end
117
+
105
118
  # Get the object id as it's raw BSON data.
106
119
  #
107
120
  # @example Get the raw bson bytes.
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "2.0.0.rc"
16
+ VERSION = "2.0.0.rc1"
17
17
  end
@@ -245,6 +245,50 @@ describe BSON::ObjectId do
245
245
  end
246
246
  end
247
247
 
248
+ describe "#eql" do
249
+
250
+ context "when data is identical" do
251
+
252
+ let(:time) do
253
+ Time.now
254
+ end
255
+
256
+ let(:object_id) do
257
+ described_class.from_time(time)
258
+ end
259
+
260
+ let(:other_id) do
261
+ described_class.from_time(time)
262
+ end
263
+
264
+ it "returns true" do
265
+ expect(object_id).to eql(other_id)
266
+ end
267
+ end
268
+
269
+ context "when the data is different" do
270
+
271
+ let(:time) do
272
+ Time.now
273
+ end
274
+
275
+ let(:object_id) do
276
+ described_class.from_time(time)
277
+ end
278
+
279
+ it "returns false" do
280
+ expect(object_id).to_not eql(described_class.new)
281
+ end
282
+ end
283
+
284
+ context "when other is not an object id" do
285
+
286
+ it "returns false" do
287
+ expect(described_class.new).to_not eql(nil)
288
+ end
289
+ end
290
+ end
291
+
248
292
  describe ".from_string" do
249
293
 
250
294
  context "when the string is valid" do
@@ -328,6 +372,17 @@ describe BSON::ObjectId do
328
372
  end
329
373
  end
330
374
 
375
+ describe "#hash" do
376
+
377
+ let(:object_id) do
378
+ described_class.new
379
+ end
380
+
381
+ it "returns a hash of the raw bytes" do
382
+ expect(object_id.hash).to eq(object_id.to_bson.hash)
383
+ end
384
+ end
385
+
331
386
  describe ".legal?" do
332
387
 
333
388
  context "when the string is too short to be an object id" do
@@ -25,6 +25,7 @@ if ENV["CI"]
25
25
  end
26
26
 
27
27
  require "bson"
28
+ require "json"
28
29
  require "rspec"
29
30
  require "yaml"
30
31
 
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: 2.0.0.rc
4
+ version: 2.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -33,7 +33,7 @@ cert_chain:
33
33
  8v7zLF2XliYbfurYIwkcXs8yPn8ggApBIy9bX6VJxRs/l2+UvqzaHIFaFy/F8/GP
34
34
  RNTuXsVG5NDACo7Q
35
35
  -----END CERTIFICATE-----
36
- date: 2013-06-12 00:00:00.000000000 Z
36
+ date: 2013-06-20 00:00:00.000000000 Z
37
37
  dependencies: []
38
38
  description: A full featured BSON specification implementation, in Ruby
39
39
  email:
@@ -78,9 +78,7 @@ files:
78
78
  - lib/bson/true_class.rb
79
79
  - lib/bson/undefined.rb
80
80
  - lib/bson/version.rb
81
- - lib/bson-ruby.jar
82
81
  - lib/bson.rb
83
- - lib/native.bundle
84
82
  - ext/bson/native.c
85
83
  - ext/bson/extconf.rb
86
84
  - spec/bson/array_spec.rb
metadata.gz.sig CHANGED
@@ -1 +1,4 @@
1
- h���-�!YU' ��cLm I��T����aF���� �#[Ȥ��{����O^ ��KP炇���P���QUJI����P� =��{�υ�AqS��y��-fDhNb���-���AFKH�v���%�C���C �y(b��#ay����K��EQ��lHW-� �T��NX�-ujϹa��x��6���������?��ɭ�����vU1?N[d�g���b��_�@��l'�<�׶��
1
+ ����7W��\�vJ]�՞`k4Jx���U$�Z�١���H%RL�Ŷ��+�EƊB/���Qi������y��`�hkzz��M��Q'A��)UoR k� t
2
+ 94p|�����m�9�� e���Y�����m����-0#\�U
3
+
4
+ PV|��W��U�8�����͞0�׻���I �������",��9��v�O�}F/ �2�E��
Binary file
Binary file