bson 1.1.2 → 1.1.3
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.
- data/Rakefile +2 -2
- data/lib/bson.rb +6 -2
- data/lib/bson/types/object_id.rb +9 -4
- data/test/bson/object_id_test.rb +5 -0
- metadata +20 -20
data/Rakefile
CHANGED
@@ -161,7 +161,7 @@ task :rdoc do
|
|
161
161
|
version = eval(File.read("mongo.gemspec")).version
|
162
162
|
out = File.join('html', version.to_s)
|
163
163
|
FileUtils.rm_rf('html')
|
164
|
-
system "rdoc --main README.
|
164
|
+
system "rdoc --main README.md --op #{out} --inline-source --quiet README.md `find lib -name '*.rb'`"
|
165
165
|
end
|
166
166
|
|
167
167
|
desc "Generate YARD documentation"
|
@@ -169,7 +169,7 @@ task :ydoc do
|
|
169
169
|
require File.join(File.dirname(__FILE__), 'lib', 'mongo')
|
170
170
|
out = File.join('ydoc', Mongo::VERSION)
|
171
171
|
FileUtils.rm_rf('ydoc')
|
172
|
-
system "yardoc lib/**/*.rb lib/mongo/**/*.rb lib/bson/**/*.rb -e yard/yard_ext.rb -p yard/templates -o #{out} --title MongoRuby-#{Mongo::VERSION} --files docs/TUTORIAL.md,docs/HISTORY.md,docs/CREDITS.md,docs/1.0_UPGRADE.md"
|
172
|
+
system "yardoc lib/**/*.rb lib/mongo/**/*.rb lib/bson/**/*.rb -e yard/yard_ext.rb -p yard/templates -o #{out} --title MongoRuby-#{Mongo::VERSION} --files docs/TUTORIAL.md,docs/GridFS.md,docs/FAQ.md,docs/REPLICA_SETS.md,docs/WRITE_CONCERN.md,docs/HISTORY.md,docs/CREDITS.md,docs/1.0_UPGRADE.md"
|
173
173
|
end
|
174
174
|
|
175
175
|
namespace :gem do
|
data/lib/bson.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
4
|
|
5
|
-
MINIMUM_BSON_EXT_VERSION = "1.1.
|
5
|
+
MINIMUM_BSON_EXT_VERSION = "1.1.3"
|
6
6
|
|
7
7
|
module BSON
|
8
|
-
VERSION = "1.1.
|
8
|
+
VERSION = "1.1.3"
|
9
9
|
def self.serialize(obj, check_keys=false, move_id=false)
|
10
10
|
BSON_CODER.serialize(obj, check_keys, move_id)
|
11
11
|
end
|
@@ -45,6 +45,10 @@ else
|
|
45
45
|
begin
|
46
46
|
# Need this for running test with and without c ext in Ruby 1.9.
|
47
47
|
raise LoadError if ENV['TEST_MODE'] && !ENV['C_EXT']
|
48
|
+
|
49
|
+
# Raise LoadError unless little endian
|
50
|
+
raise LoadError unless [1,0,0,0].pack("i").bytes.first == 1
|
51
|
+
|
48
52
|
require 'bson_ext/cbson'
|
49
53
|
raise LoadError unless defined?(CBson::VERSION)
|
50
54
|
if CBson::VERSION < MINIMUM_BSON_EXT_VERSION
|
data/lib/bson/types/object_id.rb
CHANGED
@@ -53,10 +53,7 @@ module BSON
|
|
53
53
|
#
|
54
54
|
# @return [Boolean]
|
55
55
|
def self.legal?(str)
|
56
|
-
|
57
|
-
str =~ /([0-9a-f]+)/i
|
58
|
-
match = $1
|
59
|
-
str && str.length == len && match == str
|
56
|
+
str =~ /^[0-9a-f]{24}$/i ? true : false
|
60
57
|
end
|
61
58
|
|
62
59
|
# Create an object id from the given time. This is useful for doing range
|
@@ -152,6 +149,14 @@ module BSON
|
|
152
149
|
def to_json(*a)
|
153
150
|
"{\"$oid\": \"#{to_s}\"}"
|
154
151
|
end
|
152
|
+
|
153
|
+
# Create the JSON hash structure convert to MongoDB extended format. Rails 2.3.3
|
154
|
+
# introduced as_json to create the needed hash structure to encode objects into JSON.
|
155
|
+
#
|
156
|
+
# @return [Hash] the hash representation as MongoDB extended JSON
|
157
|
+
def as_json(options ={})
|
158
|
+
{"$oid" => to_s}
|
159
|
+
end
|
155
160
|
|
156
161
|
# Return the UTC time at which this ObjectId was generated. This may
|
157
162
|
# be used in lieu of a created_at timestamp since this information
|
data/test/bson/object_id_test.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 3
|
10
|
+
version: 1.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jim Menard
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-11-
|
20
|
+
date: 2010-11-29 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies: []
|
23
23
|
|
@@ -35,30 +35,30 @@ files:
|
|
35
35
|
- bson.gemspec
|
36
36
|
- LICENSE.txt
|
37
37
|
- lib/bson.rb
|
38
|
-
- lib/bson/bson_c.rb
|
39
|
-
- lib/bson/bson_java.rb
|
40
38
|
- lib/bson/bson_ruby.rb
|
41
|
-
- lib/bson/
|
39
|
+
- lib/bson/bson_c.rb
|
42
40
|
- lib/bson/exceptions.rb
|
43
41
|
- lib/bson/ordered_hash.rb
|
44
|
-
- lib/bson/types/binary.rb
|
45
|
-
- lib/bson/types/code.rb
|
46
42
|
- lib/bson/types/dbref.rb
|
47
|
-
- lib/bson/types/
|
43
|
+
- lib/bson/types/code.rb
|
48
44
|
- lib/bson/types/object_id.rb
|
45
|
+
- lib/bson/types/binary.rb
|
46
|
+
- lib/bson/types/min_max_keys.rb
|
47
|
+
- lib/bson/byte_buffer.rb
|
48
|
+
- lib/bson/bson_java.rb
|
49
49
|
- bin/b2json
|
50
50
|
- bin/j2bson
|
51
|
-
- ext/java/jar/bson-2.2.jar
|
52
|
-
- ext/java/jar/jbson.jar
|
53
51
|
- ext/java/jar/jruby.jar
|
54
52
|
- ext/java/jar/mongo-2.2.jar
|
55
|
-
-
|
56
|
-
-
|
53
|
+
- ext/java/jar/bson-2.2.jar
|
54
|
+
- ext/java/jar/jbson.jar
|
57
55
|
- test/bson/byte_buffer_test.rb
|
58
|
-
- test/bson/
|
59
|
-
- test/bson/json_test.rb
|
56
|
+
- test/bson/binary_test.rb
|
60
57
|
- test/bson/object_id_test.rb
|
58
|
+
- test/bson/json_test.rb
|
59
|
+
- test/bson/bson_test.rb
|
61
60
|
- test/bson/ordered_hash_test.rb
|
61
|
+
- test/bson/hash_with_indifferent_access_test.rb
|
62
62
|
has_rdoc: true
|
63
63
|
homepage: http://www.mongodb.org
|
64
64
|
licenses: []
|
@@ -94,10 +94,10 @@ signing_key:
|
|
94
94
|
specification_version: 3
|
95
95
|
summary: Ruby implementation of BSON
|
96
96
|
test_files:
|
97
|
-
- test/bson/binary_test.rb
|
98
|
-
- test/bson/bson_test.rb
|
99
97
|
- test/bson/byte_buffer_test.rb
|
100
|
-
- test/bson/
|
101
|
-
- test/bson/json_test.rb
|
98
|
+
- test/bson/binary_test.rb
|
102
99
|
- test/bson/object_id_test.rb
|
100
|
+
- test/bson/json_test.rb
|
101
|
+
- test/bson/bson_test.rb
|
103
102
|
- test/bson/ordered_hash_test.rb
|
103
|
+
- test/bson/hash_with_indifferent_access_test.rb
|