mongocore 0.1.5.5 → 0.1.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e84e4c0a90381ed50bdc7912bded6cec7659fe48
4
- data.tar.gz: a8dc0e269b5f2795a4d24cdc86f821e2e61d8076
3
+ metadata.gz: 61117ab6407f2697bd0e53ea6f496c83aedc9bb8
4
+ data.tar.gz: 83964b5ff5fc6e995c3ee55f09c197be2c6a4ea2
5
5
  SHA512:
6
- metadata.gz: a6fa7f82aa0107dbbb0947fe3ca7954980e3ae752c90b6ff626f3e90de96c1a569969578fbe5cbdbc1ed467ef7cc39fb4f66dafd1e289ade151122dbea1f3c64
7
- data.tar.gz: 346c9981648cbff471c3cfe3a7b9ef028c21afbb8de698e317543e216ba39f3e144a1ac746b998c26bf4f5928aca034bcb74d14df1ef5860a97f17222aa44c9d
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
@@ -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 !!val
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
@@ -7,7 +7,7 @@ require 'mongo'
7
7
  require 'request_store'
8
8
 
9
9
  module Mongocore
10
- VERSION = '0.1.5.5'
10
+ VERSION = '0.1.5.6'
11
11
 
12
12
  # # # # # #
13
13
  # Mongocore Ruby Database Driver.
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.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."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongocore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.5
4
+ version: 0.1.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited