mongo_ql 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongo_ql/expression/value_node.rb +10 -3
- data/lib/mongo_ql/version.rb +1 -1
- data/lib/mongo_ql.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fb2a34c81b04e11611b3c4ae164bdd49ccb285e4d04b9d75b5a67f4c2495175
|
4
|
+
data.tar.gz: ba2997c9c6ae7e58453cf0b86b8b91e30d7a16fd1b7a1bcb4b6b449d3dec0013
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00c8fd708900c9a9c2b17da095b57a9f764153095a0e968a271107f251a8d0747f24c3c26c90a14272cecb349940ea162f03c92e429f8ce50963a3012fa9eb85
|
7
|
+
data.tar.gz: 3e9fcfad599743a25bb84f2b85b41caf4122a1067188be0e43436e238ea37a8f9293860e09f7e10321707c80beb84338c5c976db9bafcd75d94d63c0f32375b2
|
@@ -5,7 +5,7 @@ module MongoQL
|
|
5
5
|
SUPPORTED_TYPES = [
|
6
6
|
String, Integer, Float,
|
7
7
|
Array, Hash, TrueClass,
|
8
|
-
FalseClass, Date, Symbol,
|
8
|
+
FalseClass, Date, DateTime, Symbol,
|
9
9
|
MongoQL::Expression::ValueNode
|
10
10
|
].freeze
|
11
11
|
|
@@ -17,7 +17,14 @@ module MongoQL
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def to_ast
|
20
|
-
|
20
|
+
case value
|
21
|
+
when Date, DateTime
|
22
|
+
Expression::ValueNode.new(value.iso8601).to_date.to_ast
|
23
|
+
when MongoQL::Expression::ValueNode
|
24
|
+
value.to_ast
|
25
|
+
else
|
26
|
+
value
|
27
|
+
end
|
21
28
|
end
|
22
29
|
|
23
30
|
def self.valid?(value)
|
@@ -25,7 +32,7 @@ module MongoQL
|
|
25
32
|
end
|
26
33
|
|
27
34
|
def self.valid!(value)
|
28
|
-
unless valid?(value)
|
35
|
+
unless value.nil? || valid?(value)
|
29
36
|
raise InvalidValueExpression, "#{value} must be in type #{SUPPORTED_TYPES.map(&:name).join(",")}"
|
30
37
|
end
|
31
38
|
end
|
data/lib/mongo_ql/version.rb
CHANGED
data/lib/mongo_ql.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_ql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xizheng Ding
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|