mongoid_oslc 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
data/lib/mongoid/oslc/grammar.rb
CHANGED
@@ -30,7 +30,7 @@ module Mongoid
|
|
30
30
|
class Operator < GrammarNode
|
31
31
|
OPERATORS = {
|
32
32
|
"=" => "$in",
|
33
|
-
"!=" => "$
|
33
|
+
"!=" => "$ne",
|
34
34
|
">" => "$gt",
|
35
35
|
">=" => "$gte",
|
36
36
|
"<" => "$lt",
|
@@ -81,6 +81,12 @@ module Mongoid
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
+
class DecimalValue < GrammarNode
|
85
|
+
def to_mongo_query
|
86
|
+
text_value.to_f
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
84
90
|
class StringEsc < GrammarNode
|
85
91
|
def to_mongo_query
|
86
92
|
text_value[1...-1]
|
@@ -59,7 +59,7 @@ grammar Grammar
|
|
59
59
|
end
|
60
60
|
|
61
61
|
rule comparison_op
|
62
|
-
[
|
62
|
+
[\>\<\!]? [\=]? <Mongoid::Oslc::Grammar::Operator>
|
63
63
|
end
|
64
64
|
|
65
65
|
rule value
|
@@ -79,7 +79,7 @@ grammar Grammar
|
|
79
79
|
end
|
80
80
|
|
81
81
|
rule decimal
|
82
|
-
[\d]+
|
82
|
+
[\+\-]? [\d\.]+ <Mongoid::Oslc::Grammar::DecimalValue>
|
83
83
|
end
|
84
84
|
|
85
85
|
rule string_esc
|
data/lib/mongoid/oslc/version.rb
CHANGED
@@ -28,6 +28,18 @@ describe Mongoid::Oslc::Strategy do
|
|
28
28
|
parse_query('dcterms:created>"2010-04-01"').should eql({"created_at"=>{"$gt"=>"2010-04-01"}})
|
29
29
|
end
|
30
30
|
|
31
|
+
it "should parse query with not value" do
|
32
|
+
parse_query('dcterms:title!="First"').should eql({"title"=> {"$ne" => "First"}})
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should parse query with decimal value" do
|
36
|
+
parse_query('dcterms:title=+5').should eql({"title"=> 5.0})
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should parse query with decimal value" do
|
40
|
+
parse_query('dcterms:title=-5.151').should eql({"title"=> -5.151})
|
41
|
+
end
|
42
|
+
|
31
43
|
it "should parse query with boolean value" do
|
32
44
|
parse_query('oslc_cm:closed=true').should eql({"closed"=> true})
|
33
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_oslc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -135,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
segments:
|
137
137
|
- 0
|
138
|
-
hash:
|
138
|
+
hash: 3546982122950071674
|
139
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
segments:
|
146
146
|
- 0
|
147
|
-
hash:
|
147
|
+
hash: 3546982122950071674
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
150
|
rubygems_version: 1.8.24
|