Module: Vedeu::Store
- Includes:
- Enumerable
- Included in:
- AssociativeStore, ConveyorStore, FifoStore, Repository
- Defined in:
- lib/vedeu/storage/store.rb
Overview
Provides generic repository related behaviour.
Instance Method Summary collapse
- #each(&block) ⇒ Enumerator
-
#empty? ⇒ Boolean
Return a boolean indicating whether the storage is empty.
-
#exists?(name) ⇒ Boolean
(also: #registered?)
Returns a boolean indicating whether the named model is registered.
-
#reset ⇒ Array|Hash|Set
Remove all currently stored data.
-
#size ⇒ Fixnum
Return the number of entries stored.
-
#storage ⇒ Array|Hash|Set
(also: #all)
Return whole repository; provides raw access to the storage for this repository.
Instance Method Details
#each(&block) ⇒ Enumerator
11 12 13 |
# File 'lib/vedeu/storage/store.rb', line 11 def each(&block) storage.each(&block) end |
#empty? ⇒ Boolean
Return a boolean indicating whether the storage is empty.
29 30 31 |
# File 'lib/vedeu/storage/store.rb', line 29 def empty? storage.empty? end |
#exists?(name) ⇒ Boolean Also known as: registered?
Returns a boolean indicating whether the named model is registered.
19 20 21 22 23 |
# File 'lib/vedeu/storage/store.rb', line 19 def exists?(name) return false if empty? || name.nil? || name.empty? storage.include?(name) end |
#reset ⇒ Array|Hash|Set
Remove all currently stored data.
36 37 38 |
# File 'lib/vedeu/storage/store.rb', line 36 def reset @storage = in_memory end |
#size ⇒ Fixnum
Return the number of entries stored.
43 44 45 |
# File 'lib/vedeu/storage/store.rb', line 43 def size storage.size end |
#storage ⇒ Array|Hash|Set Also known as: all
Return whole repository; provides raw access to the storage for this repository.
51 52 53 |
# File 'lib/vedeu/storage/store.rb', line 51 def storage @storage ||= in_memory end |