mongocore 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6530290c756f80c471d9c5565e7885fcf80a2c33
4
- data.tar.gz: ba0ea77310386d919069e77552aee4620223e6ae
3
+ metadata.gz: f423817d911435069c35d9df2d045fdbe92db2ed
4
+ data.tar.gz: b621452a8e46757909ff4d890abc1a2fd7dedff0
5
5
  SHA512:
6
- metadata.gz: ecfc84ad83cf9f41669613c5925ff13aa632ace888bb4b6351d352a221a885b8114363f08cdec8449312330822d6947f2be51682190b9acfe134814d0f00d1ee
7
- data.tar.gz: 70327cb292727616e66d15c842184746be4bd8e06fd362543d358dbfec4c593d963a31a89c7a6c16c624f4e4b02d540cd50ce9263fba3a4c54382a89168e92aa
6
+ metadata.gz: bcbc8a4d12142eb73d1bf88e915b985df87322ff2fbbe888ec8783eb1750e876ece02507fd8dd139adf67220bb4f5994adec4d63cb547b1c55b6c865b4529ac0
7
+ data.tar.gz: d1d4c3fb4080dd226d37e91a220866f0aba13734fcf020f2a8c98ad5557a685c6c7795e9ccb9c049397271b6fa747536c106c2030d1448b3896c2a8284bae0f0
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Mongocore Ruby Database Driver
2
- A new MongoDB ORM implementation on top of the [MongoDB Ruby driver.](https://docs.mongodb.com/ruby-driver/master/quick-start/) Very fast and light weight.
2
+ A new MongoDB ORM implementation on top of the [latest MongoDB Ruby driver.](https://docs.mongodb.com/ruby-driver/master/quick-start/) Very fast and light weight.
3
3
 
4
4
  The perfect companion for Rails, Sinatra, Susana or other Rack-based web frameworks.
5
5
 
@@ -21,7 +21,7 @@ Please read [the source code](https://github.com/fugroup/mongocore/tree/master/l
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 | 260 | 450 |
24
+ | [Mongocore](http://mongocore.com) | 8 | 269 | 483 |
25
25
 
26
26
  <br>
27
27
 
@@ -124,6 +124,8 @@ Model.each do |m|
124
124
  puts m
125
125
  end
126
126
 
127
+ # each_with_index, each_with_object and map works as well
128
+
127
129
  # Works with finds, scopes and associations
128
130
  Model.find(:duration => 50).each{|m| puts m}
129
131
 
@@ -263,7 +265,7 @@ keys:
263
265
  # @desc: Describes the key, can be used for documentation.
264
266
  # @type: object_id, string, integer, float, boolean, time, hash, array
265
267
  # @default: the default value for the key when you call .new
266
- # @read: access level for read: all, user, dev, admin, super, app
268
+ # @read: access level for read: all, user, owner, dev, admin, super, app
267
269
  # @write: access level for write. Returns nil if no access, as on read
268
270
 
269
271
  # Object ID, usually added for each model
@@ -43,12 +43,23 @@ module Mongocore
43
43
  (tags[0] ? @keys.select{|k, v| v[:tags] & tags} : @keys).keys
44
44
  end
45
45
 
46
+ # Get time
47
+ def time(val)
48
+ case val
49
+ when Date then val.to_time.utc
50
+ when String then Time.parse(val).utc
51
+ when Time then val.utc
52
+ else nil
53
+ end
54
+ end
55
+
46
56
  # Convert type if val and schema type is set
47
57
  def convert(key, val)
48
58
  return nil if val.nil?
49
59
  case type(key)
50
60
  when :string then val.to_s
51
61
  when :integer then val.to_i
62
+ when :time then time(val)
52
63
  when :float then val.to_f
53
64
  when :boolean then val.to_s.to_bool
54
65
  when :object_id then oid(val)
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.4.0'
10
+ VERSION = '0.4.1'
11
11
 
12
12
  # # # # # #
13
13
  # Mongocore Ruby Database Driver.
data/mongocore.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'mongocore'
3
- s.version = '0.4.0'
4
- s.date = '2017-12-01'
3
+ s.version = '0.4.1'
4
+ s.date = '2018-01-10'
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."
7
7
  s.authors = ['Fugroup Limited']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongocore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-01 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongo