mongocore 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongocore/document.rb +7 -1
- data/lib/mongocore/ext.rb +1 -0
- data/lib/mongocore/query.rb +5 -0
- data/lib/mongocore.rb +1 -1
- data/mongocore.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f5279b423c7236ffb2ec14bd1e3a0452141ea85
|
4
|
+
data.tar.gz: 4b14aa11206589e12ad7d300649a8908da0e01cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c7ccbd672e2eec11c19654c60fe424ea240699d9d5242a12840dbaccca49a5daa0cdcb41006f16b2f80d759a5745b1b44cb8310e41d793404721f64684b7f0
|
7
|
+
data.tar.gz: 1a1c470e31454eede0c0c8bab19f8dcbeba44a76e3c654d379d4d1e874c683a8fc861595ffbbdb66cf77966ca834d963065745ccf953da0c1cef43e1b21f11cf
|
data/lib/mongocore/document.rb
CHANGED
@@ -223,7 +223,7 @@ module Mongocore
|
|
223
223
|
|
224
224
|
# Replace _id with id, takes a hash
|
225
225
|
def string_id(a)
|
226
|
-
a.delete(:_id); {:id => id}.merge(a)
|
226
|
+
a.each{|k, v| a[k] = v.to_s}; a.delete(:_id); {:id => id}.merge(a)
|
227
227
|
end
|
228
228
|
|
229
229
|
private
|
@@ -295,6 +295,12 @@ module Mongocore
|
|
295
295
|
def insert(a = {}, o = {})
|
296
296
|
new(a).tap{|r| r.save(o)}
|
297
297
|
end
|
298
|
+
|
299
|
+
# Each
|
300
|
+
def each(&block)
|
301
|
+
find.each{|r| yield(r)}
|
302
|
+
end
|
303
|
+
|
298
304
|
# # # # # # # # #
|
299
305
|
# After, before and validation filters
|
300
306
|
# Pass a method name as symbol or a block
|
data/lib/mongocore/ext.rb
CHANGED
data/lib/mongocore/query.rb
CHANGED
@@ -136,6 +136,11 @@ module Mongocore
|
|
136
136
|
cursor.send(t).tap{|r| cache.set(t, r) if Mongocore.cache}
|
137
137
|
end
|
138
138
|
|
139
|
+
# Each
|
140
|
+
def each(&block)
|
141
|
+
cursor.each{|r| yield(modelize(r))}
|
142
|
+
end
|
143
|
+
|
139
144
|
# Sort
|
140
145
|
def sort(o = {})
|
141
146
|
find(@query, @options, @store.tap{store[:sort].merge!(o)})
|
data/lib/mongocore.rb
CHANGED
data/mongocore.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mongocore'
|
3
|
-
s.version = '0.1.
|
4
|
-
s.date = '2017-10-
|
3
|
+
s.version = '0.1.8'
|
4
|
+
s.date = '2017-10-24'
|
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.1.
|
4
|
+
version: 0.1.8
|
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-10-
|
11
|
+
date: 2017-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongo
|