mongocore 0.1.5.3 → 0.1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongocore/query.rb +1 -1
- data/lib/mongocore/schema.rb +9 -8
- data/lib/mongocore.rb +1 -1
- data/mongocore.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 528cba77e5787960a365aa15629a703e41fcedd3
|
4
|
+
data.tar.gz: 774cb561e0ce794c80a3ff3a03e0cc00c8ec767c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4648a17cbc9670bef907be425fa17a3c50a924cefedf7f35e08364130c0f409c3f130abc39d896a8dfc4091cd3801b75b67e537bf745079888852a15585e2e91
|
7
|
+
data.tar.gz: d3a1921104bbbc4f26ab79bbe789105fb878e285e1dbf13cdfcd5a0130320d11ad2dde5b345ae81e0d81abbe1f71cf275cba2543163dfb00206ac11f70c6c251
|
data/lib/mongocore/query.rb
CHANGED
data/lib/mongocore/schema.rb
CHANGED
@@ -46,17 +46,18 @@ module Mongocore
|
|
46
46
|
# Convert type if val and schema type is set
|
47
47
|
def convert(key, val)
|
48
48
|
return nil if val.nil?
|
49
|
-
type = @keys[key][:type].to_sym rescue
|
50
|
-
return val if type.nil?
|
49
|
+
type = @keys[key][:type].to_sym rescue :string
|
51
50
|
|
52
51
|
# Convert to the same type as in the schema
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
if type == :string then val.to_s
|
53
|
+
elsif type == :integer then val.to_i
|
54
|
+
elsif type == :float then val.to_f
|
55
|
+
elsif type == :boolean then !!val
|
56
|
+
elsif type == :object_id && val.is_a?(String)
|
57
|
+
BSON::ObjectId.from_string(val) rescue nil
|
58
|
+
else
|
59
|
+
val
|
58
60
|
end
|
59
|
-
val
|
60
61
|
end
|
61
62
|
|
62
63
|
# # # # # # # # #
|
data/lib/mongocore.rb
CHANGED
data/mongocore.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mongocore'
|
3
|
-
s.version = '0.1.5.
|
3
|
+
s.version = '0.1.5.4'
|
4
4
|
s.date = '2017-10-18'
|
5
5
|
s.summary = "MongoDB ORM implementation on top of the Ruby MongoDB driver"
|
6
6
|
s.description = "Does validations, associations, scopes, filters, pagination, counter cache, request cache, and nested queries. Using a YAML schema file, which supports default values, data types, and security levels for each key."
|