depository 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWUzMGFlMDcyYWIxYzU0NGJhZjk2YWFkNTk4YWZmYTI4ZDJhOTIxYg==
4
+ Nzc3Y2Q3NzJmZDAxMjI4N2RmZmRlYjJlOGQ3NjVkZmZjNGE2ZjFjZA==
5
5
  data.tar.gz: !binary |-
6
- MDQyMGYxODljMGVlOGIwYjFlNWJiNTVmNjcxZjFiNWUzNjM2YmNmNg==
6
+ ZmM5M2QxMGM3NTdlY2NiMDg4N2EzN2FjOTVhNmUxNjZlYTIyY2Q3OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODU5MTNkNDU3NDYwYzQyYjc0MTFhYTJhMWFlNzU0ZDc4YjE0OWRlYzMxMzZh
10
- ZGNlODcyMTFkMmEyYmIwNjE5YjBiNzRkMWFkMWU5ZDQ4NjdiZTcyOTBlMDQ3
11
- ZmQ5NGQ2NjA4ZDQ4NWJhMWI2ODk2NmQ1ZThiNzUxYmJiYzQ4MmQ=
9
+ YWQ5MjZjYTdkMGZjYTk0MjY0MGMwOWFlOTBjMTVmNTIyOTg0ZmRjODIwNzky
10
+ YWI1ODBiMzk3MGNjYWJjMmNiNDQ3ODRjYjBhMDkxNDM1MjQ4NTVjOWU3MGIw
11
+ MTIyYjAzMjFiNzc4NGYxZmE3MDcwOTMwZGI4YTQ1NzM1ODg5MzM=
12
12
  data.tar.gz: !binary |-
13
- OTNhNzE3NzhiOGFiODYzMTg0YWZkNjIzNTQ5ODQzYjk4YmU2ZjQxMjQyMjk0
14
- YTVjZDYzZTM2MGNiNjY0NWFlYzUwYTViNDdkMTVmYzFiOGY4OGVmMzE3MzRk
15
- ZDQ1OGY0NmM3NWYzOGIxYjcxZDllMjAwMDM5YzM4NzdjNzY3MTk=
13
+ MjljZDc0MGI0OWJlMGUxM2U1MTJiYWY1MGMwZDkxYzE5NzExOWFkOTcyYWUz
14
+ NTU0MTdlODcwNWM1MmM0NTQ5ZGJiODA2ODc3NzdhZTljNmFjMTdlYTU5YWI3
15
+ MWMzZmYwOGVlYTc5MDE5MDM1ODIwMGE0ZWUyZDE2ZmQzOTNjZGM=
@@ -23,12 +23,12 @@ module Depository
23
23
  self._model_class ||= _model_block.call
24
24
  end
25
25
 
26
- def use_db(db_name)
27
- self._db_name = db_name
26
+ def use_db(db)
27
+ db.is_a?(Symbol) ? self._db_name = db : @_db = Result.new(db, self)
28
28
  end
29
29
 
30
30
  def db
31
- Depository::Database.db_for(self)
31
+ @_db ||= Result.new(Database[_db_name], self)
32
32
  end
33
33
 
34
34
  def primary_key
@@ -59,10 +59,6 @@ module Depository
59
59
  db.where(primary_key => key).delete
60
60
  end
61
61
 
62
- def count
63
- db.raw.size
64
- end
65
-
66
62
  def convert(attrs)
67
63
  case attrs
68
64
  when Array
@@ -14,6 +14,10 @@ module Depository
14
14
  def db_for(collection)
15
15
  Result.new(self.db[collection._db_name], collection)
16
16
  end
17
+
18
+ def [](name)
19
+ self.db[name]
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -10,7 +10,7 @@ module Depository
10
10
 
11
11
  attr_protected :db, :collection
12
12
 
13
- def_delegators :db, *[:update, :insert, :delete, :max, :min]
13
+ def_delegators :db, *[:update, :insert, :delete, :max, :min, :count]
14
14
 
15
15
  def initialize(db, collection)
16
16
  self.db = db
@@ -11,7 +11,7 @@ module Depository
11
11
  :order_append, :order_prepend, :order_more, :reverse, :reverse_order,
12
12
  :unordered, :limit, :offset, :unlimited, :union, :intersect, :except,
13
13
  :for_update, :lock_style, :with, :with_recursive, :clone, :distinct,
14
- :naked, :qualify, :server, :with_sql,
14
+ :naked, :qualify, :server, :with_sql, :count,
15
15
  :insert, :update, :delete, :max, :min]
16
16
 
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: depository
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pratt
@@ -101,7 +101,7 @@ files:
101
101
  - lib/depository/model.rb
102
102
  - lib/depository/result.rb
103
103
  - lib/depository/sequel.rb
104
- homepage: http://8thlight.com
104
+ homepage: https://github.com/pratt121/depository
105
105
  licenses:
106
106
  - WTFPL
107
107
  metadata: {}