Module: Vedeu::Repositories
- Extended by:
- Repositories
- Included in:
- Repositories
- Defined in:
- lib/vedeu/repositories/all.rb,
lib/vedeu/repositories/cache.rb,
lib/vedeu/repositories/model.rb,
lib/vedeu/repositories/store.rb,
lib/vedeu/repositories/storage.rb,
lib/vedeu/repositories/defaults.rb,
lib/vedeu/repositories/assemblage.rb,
lib/vedeu/repositories/collection.rb,
lib/vedeu/repositories/repository.rb,
lib/vedeu/repositories/registerable.rb,
lib/vedeu/repositories/repositories.rb
Overview
Provides all registered repositories.
Defined Under Namespace
Modules: Assemblage, Defaults, Model, Registerable, Storage, Store Classes: Cache, Collection, Repository
Instance Method Summary collapse
-
#all ⇒ Array
Access all the repositories stored.
-
#register(klass) ⇒ Set
Register a repository with the collection of Vedeu repositories.
-
#registered ⇒ Array
List all models stored in each registered repository.
-
#repositories ⇒ Array
Access all the repositories stored.
-
#reset! ⇒ Boolean
(also: #reset)
Remove all stored models from the repository.
-
#storage ⇒ Array
private
Access to the storage for this repository.
Instance Method Details
#all ⇒ Array
Access all the repositories stored.
14 15 16 |
# File 'lib/vedeu/repositories/repositories.rb', line 14 def all storage.map(&:repository) end |
#register(klass) ⇒ Set
Register a repository with the collection of Vedeu repositories.
22 23 24 |
# File 'lib/vedeu/repositories/repositories.rb', line 22 def register(klass) storage.add(klass) if klass end |
#registered ⇒ Array
List all models stored in each registered repository.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vedeu/repositories/repositories.rb', line 29 def registered all.map do |repository| registered = repository.send(:registered) Vedeu.log(type: :store, message: "Repository '#{repository.class.name}':" \ " #{registered.inspect}") registered end end |
#repositories ⇒ Array
Access all the repositories stored.
44 45 46 |
# File 'lib/vedeu/repositories/repositories.rb', line 44 def repositories self end |
#reset! ⇒ Boolean Also known as: reset
Remove all stored models from the repository.
51 52 53 54 55 56 57 58 59 |
# File 'lib/vedeu/repositories/repositories.rb', line 51 def reset! storage.map do |repository| Vedeu.log(type: :red, message: "Resetting: #{repository.name}") repository.reset! end true end |
#storage ⇒ Array (private)
Access to the storage for this repository.
67 68 69 |
# File 'lib/vedeu/repositories/repositories.rb', line 67 def storage @_storage ||= Set.new end |