bson 1.2.rc1-jruby → 1.2.rc2-jruby
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.
Potentially problematic release.
This version of bson might be problematic. Click here for more details.
- data/lib/bson.rb +2 -2
- data/lib/bson/types/code.rb +8 -0
- data/test/bson/bson_test.rb +6 -0
- metadata +4 -4
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.2.
|
5
|
+
MINIMUM_BSON_EXT_VERSION = "1.2.rc2"
|
6
6
|
|
7
7
|
module BSON
|
8
|
-
VERSION = "1.2.
|
8
|
+
VERSION = "1.2.rc2"
|
9
9
|
|
10
10
|
if defined? Mongo::DEFAULT_MAX_BSON_SIZE
|
11
11
|
DEFAULT_MAX_BSON_SIZE = Mongo::DEFAULT_MAX_BSON_SIZE
|
data/lib/bson/types/code.rb
CHANGED
@@ -32,6 +32,10 @@ module BSON
|
|
32
32
|
def initialize(code, scope={})
|
33
33
|
@code = code
|
34
34
|
@scope = scope
|
35
|
+
|
36
|
+
unless @code.is_a?(String)
|
37
|
+
raise ArgumentError, "BSON::Code must be in the form of a String; #{@code.class} is not allowed."
|
38
|
+
end
|
35
39
|
end
|
36
40
|
|
37
41
|
def length
|
@@ -47,5 +51,9 @@ module BSON
|
|
47
51
|
"<BSON::Code:#{object_id} @data=\"#{@code}\" @scope=\"#{@scope.inspect}\">"
|
48
52
|
end
|
49
53
|
|
54
|
+
def to_bson_code
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
50
58
|
end
|
51
59
|
end
|
data/test/bson/bson_test.rb
CHANGED
@@ -150,6 +150,12 @@ class BSONTest < Test::Unit::TestCase
|
|
150
150
|
assert_doc_pass(doc)
|
151
151
|
end
|
152
152
|
|
153
|
+
def test_code_with_symbol
|
154
|
+
assert_raise_error ArgumentError, "BSON::Code must be in the form of a String" do
|
155
|
+
Code.new(:fubar)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
153
159
|
def test_code_with_scope
|
154
160
|
doc = {'$where' => Code.new('this.a.b < this.b', {'foo' => 1})}
|
155
161
|
assert_doc_pass(doc)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424225
|
5
5
|
prerelease: 4
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
9
|
- rc
|
10
|
-
-
|
11
|
-
version: 1.2.
|
10
|
+
- 2
|
11
|
+
version: 1.2.rc2
|
12
12
|
platform: jruby
|
13
13
|
authors:
|
14
14
|
- Jim Menard
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-01-
|
21
|
+
date: 2011-01-06 00:00:00 -05:00
|
22
22
|
default_executable:
|
23
23
|
dependencies: []
|
24
24
|
|