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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff361af802468448993a0b22de79589a65bcff42
4
- data.tar.gz: 99d3e60ba23ec6b137e16703cdb2cea124352bd1
3
+ metadata.gz: 49e52748c010ba63d35b303c12e9995c34dea5da
4
+ data.tar.gz: 4a247e20420bf65aee98f681992f7a8a0c47a26e
5
5
  SHA512:
6
- metadata.gz: b3bbf3021c62a0b89e1448c1cd51d44cfcb6cc4fa483fd93b692d45e433aeccae6d0af9ae920a7e42e7329b85c1af95577e5c2c95447850fc158a006495f7d7e
7
- data.tar.gz: 5dd73f48357535ccfb055e6b7a3ab502f5f03d03b097732ac5a2c0c3e6aec066afeb98e3c8b2dac1b7cbec8e2b079b1040415d99333a6e6f2da40ba95efe358c
6
+ metadata.gz: 85089d12dcc06fc13ba1a284a5f8f22ac758d89d8b69798dd7688d513e323677513445749c8216974da3ab4bd4b3527e3809aac9c7515182faf4f58e05a5b6c8
7
+ data.tar.gz: 250ed61c4da0848117341de56d6506d649692f2a643a782bb4b2c15d800033e0e314c18fcc056fd0f2efa942536fa0a36ed1edaff69b98548c4eed4b07e58aa7
@@ -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 = class_name.singularize.constantize
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
@@ -1,3 +1,3 @@
1
1
  module RRepo
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrepo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joakim Reinert