rrepo 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rrepo/adapters/mongo.rb +13 -3
- data/lib/rrepo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89873ed098ba32208c31ceaae415605d5cd6f4aa
|
4
|
+
data.tar.gz: 82feca29e6fdf69dd31babc5d720bd0bf871b19a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da16c7cfa53a57293d345c77dec8bc8d17b7dcf7d37e6bba1525d763d98661e812b9e8f23eb0e22b541b87fdb58fbeee6f2009128e77c66d58b84bf324f6f510
|
7
|
+
data.tar.gz: 5a329c7a8ecf75c61f7f6232b7f55037bd93872c252818c0baab9c842fc7155e3ef4c0bca52ac90608ceb8f4a5a130f23219cad55ff3109dd7d95a3e68cd3f12
|
data/lib/rrepo/adapters/mongo.rb
CHANGED
@@ -44,16 +44,26 @@ module RRepo
|
|
44
44
|
class Query
|
45
45
|
def initialize(collection, &block)
|
46
46
|
@collection = collection
|
47
|
-
@query = {}
|
47
|
+
@query = [{}]
|
48
48
|
instance_eval(&block) if block_given?
|
49
49
|
end
|
50
50
|
|
51
51
|
def where(condition)
|
52
|
-
@query.merge!(condition)
|
52
|
+
@query.last.merge!(condition)
|
53
|
+
self
|
54
|
+
end
|
55
|
+
|
56
|
+
def or
|
57
|
+
@query << {}
|
58
|
+
self
|
53
59
|
end
|
54
60
|
|
55
61
|
def run
|
56
|
-
@
|
62
|
+
if @query.size > 1
|
63
|
+
@collection.find(:$or => @query)
|
64
|
+
else
|
65
|
+
@collection.find(@query.first)
|
66
|
+
end
|
57
67
|
end
|
58
68
|
|
59
69
|
def to_hash
|
data/lib/rrepo/version.rb
CHANGED