mongery 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/mongery.rb +8 -7
- data/lib/mongery/version.rb +1 -1
- data/spec/mongery/builder_schema_spec.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03d8acfca1ec4e920360fd762c038d5418f2cfaf
|
4
|
+
data.tar.gz: 66f7ec10c8e575b4bbdfbed72a35405c2fb40a4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16ccca0d85eed4fe6c7f2cbdf391b26485196a9051d04be639f9a6b3dbb175e701d724c8edff4a0c972649ad5dad84cd702901a10991bee175aa6c29ed350c26
|
7
|
+
data.tar.gz: aa49ffa0ba15edc1a5a2efc4fc108c49845155ae7f033797e57e8ca4091da951f4062c4a7516e5582f6c20f8cf49754d2a8549781dc55c96f2fb511007e2d481
|
data/CHANGELOG.md
CHANGED
data/lib/mongery.rb
CHANGED
@@ -263,17 +263,18 @@ module Mongery
|
|
263
263
|
end
|
264
264
|
|
265
265
|
def compare_schema(col, val, type, op)
|
266
|
-
wrap_schema(col, type).send(op, val)
|
267
|
-
end
|
268
|
-
|
269
|
-
def wrap_schema(col, type)
|
270
266
|
case type
|
271
267
|
when "string"
|
272
|
-
Arel.sql("(#{col})")
|
268
|
+
Arel.sql("(#{col})").send(op, val)
|
273
269
|
when "number", "integer"
|
274
|
-
Arel.sql("(#{col})::numeric")
|
270
|
+
Arel.sql("(#{col})::numeric").send(op, val)
|
275
271
|
else
|
276
|
-
|
272
|
+
case val
|
273
|
+
when Numeric
|
274
|
+
Arel.sql("(#{col})").send(op, val.to_s)
|
275
|
+
else
|
276
|
+
Arel.sql("(#{col})").send(op, val)
|
277
|
+
end
|
277
278
|
end
|
278
279
|
end
|
279
280
|
|
data/lib/mongery/version.rb
CHANGED
@@ -16,7 +16,13 @@ describe Mongery::Builder do
|
|
16
16
|
[ { tag: {"$in" => [ "food", "recipe" ]} },
|
17
17
|
/WHERE \(data#>>'{tag}' ILIKE '%"food"%' OR data#>>'{tag}' ILIKE '%"recipe"%'\)$/ ],
|
18
18
|
[ { active: true },
|
19
|
-
/WHERE data#>>'{active}' = 'true'$/ ],
|
19
|
+
/WHERE \(data#>>'{active}'\) = 'true'$/ ],
|
20
|
+
[ { height: 2.1 },
|
21
|
+
/WHERE \(data#>>'{height}'\) = '2\.1'$/ ],
|
22
|
+
[ { height: { '$in' => ['6.1', '6.2'] } },
|
23
|
+
/WHERE \(data#>>'{height}'\) IN \('6\.1', '6\.2'\)$/ ],
|
24
|
+
[ { height: nil },
|
25
|
+
/WHERE \(data#>>'{height}'\) IS NULL$/ ],
|
20
26
|
]
|
21
27
|
|
22
28
|
schema = JsonSchema.parse!(JSON.parse(<<-EOF))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tatsuhiko Miyagawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arel
|