rrepo 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rrepo/repository.rb +16 -2
- 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: 49e52748c010ba63d35b303c12e9995c34dea5da
|
4
|
+
data.tar.gz: 4a247e20420bf65aee98f681992f7a8a0c47a26e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85089d12dcc06fc13ba1a284a5f8f22ac758d89d8b69798dd7688d513e323677513445749c8216974da3ab4bd4b3527e3809aac9c7515182faf4f58e05a5b6c8
|
7
|
+
data.tar.gz: 250ed61c4da0848117341de56d6506d649692f2a643a782bb4b2c15d800033e0e314c18fcc056fd0f2efa942536fa0a36ed1edaff69b98548c4eed4b07e58aa7
|
data/lib/rrepo/repository.rb
CHANGED
@@ -8,14 +8,28 @@ module RRepo
|
|
8
8
|
class Repository
|
9
9
|
include Abstractize
|
10
10
|
|
11
|
+
class << self
|
12
|
+
def collection(collection = nil)
|
13
|
+
return @collection = collection if collection.present?
|
14
|
+
@collection
|
15
|
+
end
|
16
|
+
|
17
|
+
def model_class_name(name = nil)
|
18
|
+
return @model_class_name = name if name.present?
|
19
|
+
@model_class_name
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
11
23
|
attr_reader :collection, :adapter, :model_class
|
12
24
|
|
13
25
|
def initialize(adapter)
|
14
26
|
@adapter = adapter
|
15
27
|
class_name = self.class.name.demodulize
|
16
|
-
@collection = class_name.underscore.to_sym
|
28
|
+
@collection = (self.class.collection || class_name.underscore).to_sym
|
17
29
|
return if class_name == 'Repository'
|
18
|
-
@model_class =
|
30
|
+
@model_class = (
|
31
|
+
self.class.model_class_name || class_name.singularize
|
32
|
+
).constantize
|
19
33
|
end
|
20
34
|
|
21
35
|
def create(model)
|
data/lib/rrepo/version.rb
CHANGED