mongocore 0.3.1 → 0.3.1.1

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: b41d351659b6eb32abc203fcf4bfca71475fa310
4
- data.tar.gz: 0f62bcc88e7c58aa4574fd0bd2c78366bbba886a
3
+ metadata.gz: d0d675c271e8b08722c8c8718eff9c47a0a063a2
4
+ data.tar.gz: d9d09c93594c0753aebb8828d701af09fae02622
5
5
  SHA512:
6
- metadata.gz: fdf761b37d0e415e7806bfa5e908737160ae2a9f59d6f0315c58b05cb8dad87448bd3d79049fe9ab224b3c9baf5164b430de8be51ffadfff914182ca0c911055
7
- data.tar.gz: 91d1fc13533117f0ddf899d6fd29b18a5110c490731f35a9914e2ced321c0658d29ac066ab8a5dc9ad8c436246acac6d5603d99ebffd7dff2364f916e2d63b8d
6
+ metadata.gz: '038870dd3510025c0542a87bf6772b164b7069647c33f557818640c0eacdf3b9fa76e7b17db1e8edcbff73a68d492b209e737e8f223a767499d3fc47d15ca367'
7
+ data.tar.gz: 7a8081b233a7ccd57a614e454246019b5bc68dea029d5b78557d03f2e74614b177d9f98f0d34713ac70a8fb460bc1d34f4c3b7290554a5380301653f7f00b1f2
data/README.md CHANGED
@@ -15,13 +15,13 @@ With Mongocore you can do:
15
15
 
16
16
  The schema is specified with a YAML file which supports default values, data types, and security levels for each key.
17
17
 
18
- Please read [the source code](https://github.com/fugroup/mongocore/tree/master/lib/mongocore) to see how it works, it's fully commented and very small, only 8 files, and 447 lines of fully test driven code.
18
+ Please read [the source code](https://github.com/fugroup/mongocore/tree/master/lib/mongocore) to see how it works, it's fully commented and very small, only 8 files, and 450 lines of fully test driven code.
19
19
 
20
20
  | Library | Files | Comment | Lines of code |
21
21
  | -------------------------------------- | ----- | ------- | ------------- |
22
22
  | [Mongoid](http://mongoid.com) | 256 | 14371 | 10590 |
23
23
  | [MongoMapper](http://mongomapper.com) | 91 | 200 | 4070 |
24
- | [Mongocore](http://mongocore.com) | 8 | 253 | 447 |
24
+ | [Mongocore](http://mongocore.com) | 8 | 260 | 450 |
25
25
 
26
26
  <br>
27
27
 
@@ -169,7 +169,7 @@ module Mongocore
169
169
 
170
170
  # Get attribute if access
171
171
  def read(key)
172
- self.class.access.read?(key) ? read!(key) : nil
172
+ self.class.access.read?((key = key.to_sym)) ? read!(key) : nil
173
173
  end
174
174
 
175
175
  # Get attribute
@@ -179,7 +179,7 @@ module Mongocore
179
179
 
180
180
  # Set attribute if access
181
181
  def write(key, val)
182
- return nil unless self.class.access.write?(key)
182
+ return nil unless self.class.access.write?((key = key.to_sym))
183
183
 
184
184
  # Convert to type as in schema yml
185
185
  v = self.class.schema.convert(key, val)
@@ -104,7 +104,7 @@ module Mongocore
104
104
  end
105
105
 
106
106
  def #{$1}=(m)
107
- @#{key} = m ? m._id : nil
107
+ @#{key} = m._id rescue (BSON::ObjectId.from_string(m) rescue m)
108
108
  @#{$1} = m
109
109
  end
110
110
  }
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.3.1'
10
+ VERSION = '0.3.1.1'
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.3.1'
3
+ s.version = '0.3.1.1'
4
4
  s.date = '2017-11-25'
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.3.1
4
+ version: 0.3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited