mongocore 0.1.7 → 0.1.8

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: ad5f759d0098c30be1771c2f96dc97b16d3f3f3c
4
- data.tar.gz: 2e427d8c0bfbb4e878e592b28caf2fa4ae089fd5
3
+ metadata.gz: 2f5279b423c7236ffb2ec14bd1e3a0452141ea85
4
+ data.tar.gz: 4b14aa11206589e12ad7d300649a8908da0e01cb
5
5
  SHA512:
6
- metadata.gz: 9cacabc91e2e7a783ee9766e4fd1328c7609c71ff78a76343f96e7bc1dfb73b1e329db3417ca0333edc098acd9d59612916cd59bb261c93bc942653ec9d8eb7a
7
- data.tar.gz: 0b6d23cebdc0a0c9f5d7a4bdea56eaba1819f688782bf72db8c29fd4ce4d5fd202b64c9a1e2675ab9019722e3abc2e72ad963ca7ce885a146c5d26edac790d45
6
+ metadata.gz: 51c7ccbd672e2eec11c19654c60fe424ea240699d9d5242a12840dbaccca49a5daa0cdcb41006f16b2f80d759a5745b1b44cb8310e41d793404721f64684b7f0
7
+ data.tar.gz: 1a1c470e31454eede0c0c8bab19f8dcbeba44a76e3c654d379d4d1e874c683a8fc861595ffbbdb66cf77966ca834d963065745ccf953da0c1cef43e1b21f11cf
@@ -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
@@ -16,4 +16,5 @@ class String
16
16
 
17
17
  raise ArgumentError.new %{invalid value: #{self}}
18
18
  end
19
+
19
20
  end
@@ -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
@@ -7,7 +7,7 @@ require 'mongo'
7
7
  require 'request_store'
8
8
 
9
9
  module Mongocore
10
- VERSION = '0.1.7'
10
+ VERSION = '0.1.8'
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.1.7'
4
- s.date = '2017-10-21'
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.7
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-21 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongo