rrepo 0.2.1 → 0.2.2
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/base.rb +1 -0
- data/lib/rrepo/adapters/mongo.rb +25 -0
- data/lib/rrepo/repository.rb +4 -0
- data/lib/rrepo/version.rb +1 -1
- 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: 690bbb86e5cd0139e860c576eb34777247801b3a
|
4
|
+
data.tar.gz: 3125867972c8c75cb44c2a567415eda1b1033389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bef670ade1b2d25bcee6bff84d6c68fab10b2ebd1c00fb0e07b75446cae0ce1dff9b8a434f8969f31e536dcfaf3ec9bb17f5371a5a4d3ea682435464ada2c22
|
7
|
+
data.tar.gz: b1a52c43cc1d4e9a25a80ad26f0533b8ebd3e23cffafbbe34b2db2bea3017e390cce5e89b18a404f9c44948ab61527599246cc2925ca0868afe2c0e24b66d41a
|
data/lib/rrepo/adapters/base.rb
CHANGED
data/lib/rrepo/adapters/mongo.rb
CHANGED
@@ -37,6 +37,31 @@ module RRepo
|
|
37
37
|
@db[collection].drop
|
38
38
|
end
|
39
39
|
|
40
|
+
def query(collection, &block)
|
41
|
+
Query.new(@db[collection], &block)
|
42
|
+
end
|
43
|
+
|
44
|
+
# A Mongo Query object
|
45
|
+
class Query
|
46
|
+
def initialize(collection, &block)
|
47
|
+
@collection = collection
|
48
|
+
@query = {}
|
49
|
+
instance_eval(&block) if block_given?
|
50
|
+
end
|
51
|
+
|
52
|
+
def where(condition)
|
53
|
+
@query.merge(condition)
|
54
|
+
end
|
55
|
+
|
56
|
+
def run
|
57
|
+
@collection.find(@query)
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_hash
|
61
|
+
@query
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
40
65
|
protected
|
41
66
|
|
42
67
|
def id_query(id)
|
data/lib/rrepo/repository.rb
CHANGED
data/lib/rrepo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rrepo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joakim Reinert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|