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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Rakefile +10 -4
- data/ext/bson/native.c +8 -1
- data/lib/bson/json.rb +0 -2
- data/lib/bson/object_id.rb +13 -0
- data/lib/bson/version.rb +1 -1
- data/spec/bson/object_id_spec.rb +55 -0
- data/spec/spec_helper.rb +1 -0
- metadata +2 -4
- metadata.gz.sig +4 -1
- data/lib/bson-ruby.jar +0 -0
- data/lib/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: da650cd5a81e6fbf7d40be183308904d83359e54
|
4
|
+
data.tar.gz: 1aa6c7977bbe2b62fb957d7f8435db70350407f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd716b5ca171488c93c5d807d501684f31c23fd495466851fdead27a0a2b8c307856c8a014ad52923552792b3068bb65c5da08a2dbaa9089df1d95a7a3edba5d
|
7
|
+
data.tar.gz: 2c6086856793c542f66d7394885a7620b434f334f995c644298aa367d4f9af5b5ff87f17cb7ee24494e52052afff0ea3ea3d51f780d44f75a21ebc4b3685df04
|
checksums.yaml.gz.sig
CHANGED
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
|
-
|
60
|
-
|
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
|
71
|
+
Dir.chdir(Pathname(__FILE__).dirname + "lib") do
|
66
72
|
`rm native.#{extension}`
|
67
73
|
`rm native.o`
|
68
|
-
`rm
|
74
|
+
`rm bson-ruby.jar`
|
69
75
|
end
|
70
76
|
rescue Exception => e
|
71
77
|
puts e.message
|
data/ext/bson/native.c
CHANGED
@@ -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
|
/**
|
data/lib/bson/json.rb
CHANGED
data/lib/bson/object_id.rb
CHANGED
@@ -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.
|
data/lib/bson/version.rb
CHANGED
data/spec/bson/object_id_spec.rb
CHANGED
@@ -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
|
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: 2.0.0.
|
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-
|
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
|
-
�
|
1
|
+
����7W��\�v�J�]�՞`k4�J�x���U$�Z�١���H%RL� �Ŷ��+�EƊB/���Qi������y��`�h�kzz��M��Q�'A��)U�o�R 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��
|
data/lib/bson-ruby.jar
DELETED
Binary file
|
data/lib/native.bundle
DELETED
Binary file
|