mongocore 0.1.5.5 → 0.1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongocore/ext.rb +11 -0
- data/lib/mongocore/schema.rb +1 -1
- 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: 61117ab6407f2697bd0e53ea6f496c83aedc9bb8
|
4
|
+
data.tar.gz: 83964b5ff5fc6e995c3ee55f09c197be2c6a4ea2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38abb821b9d54b9be87a853eb1b78b450269655e1f5038d212302dc6ba331f5e733162cb9ddd6e4f9a02613f6bb4bafd10d1fa8a284a9f619a47c315b6f0342a
|
7
|
+
data.tar.gz: 813e69998c70273fd3fdd68a2346392d7c656ca00a4838fe65e13c8ef6d25394867ddb8bb506f3b65918ee495b4d1bc36e030ed91b5f753b87140041b3810f28
|
data/lib/mongocore/ext.rb
CHANGED
@@ -6,3 +6,14 @@ class Array
|
|
6
6
|
attr_accessor :total
|
7
7
|
|
8
8
|
end
|
9
|
+
|
10
|
+
class String
|
11
|
+
|
12
|
+
# Adding a to_bool method
|
13
|
+
def to_bool
|
14
|
+
return true if self =~ (/^(true|yes|t|y|[1-9]+)$/i)
|
15
|
+
return false if self.empty? || self =~ (/^(false|no|n|f|0)$/i)
|
16
|
+
|
17
|
+
raise ArgumentError.new %{invalid value: #{self}}
|
18
|
+
end
|
19
|
+
end
|
data/lib/mongocore/schema.rb
CHANGED
@@ -52,7 +52,7 @@ module Mongocore
|
|
52
52
|
if type == :string then val.to_s
|
53
53
|
elsif type == :integer then val.to_i
|
54
54
|
elsif type == :float then val.to_f
|
55
|
-
elsif type == :boolean then
|
55
|
+
elsif type == :boolean then val.to_s.to_bool
|
56
56
|
elsif type == :object_id && !val.is_a?(BSON::ObjectId)
|
57
57
|
BSON::ObjectId.from_string(val) rescue nil
|
58
58
|
else
|
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.6'
|
4
4
|
s.date = '2017-10-20'
|
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."
|