Module: Vedeu::Repositories::Store Private
- Included in:
- Repository
- Defined in:
- lib/vedeu/repositories/store.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Provides generic repository related behaviour.
Instance Method Summary collapse
- #each(&block) ⇒ Enumerator private
-
#empty? ⇒ Boolean
private
Return a boolean indicating whether the storage is empty.
-
#exists?(name) ⇒ Boolean
(also: #registered?)
private
Returns a boolean indicating whether the named model is registered.
- #in_memory ⇒ Hash private
-
#registered ⇒ Array
private
Returns a collection of the names of all the registered entities.
-
#size ⇒ Fixnum
private
Return the number of entries stored.
Methods included from Storage
Methods included from Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Instance Method Details
#each(&block) ⇒ Enumerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 |
# File 'lib/vedeu/repositories/store.rb', line 22 def each(&block) storage.each(&block) end |
#empty? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a boolean indicating whether the storage is empty.
29 30 31 |
# File 'lib/vedeu/repositories/store.rb', line 29 def empty? storage.empty? end |
#exists?(name) ⇒ Boolean Also known as: registered?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a boolean indicating whether the named model is registered.
38 39 40 41 42 |
# File 'lib/vedeu/repositories/store.rb', line 38 def exists?(name) return false if empty? || absent?(name) storage.include?(name) end |
#in_memory ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
65 66 67 |
# File 'lib/vedeu/repositories/store.rb', line 65 def in_memory {} end |
#registered ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a collection of the names of all the registered entities.
49 50 51 52 53 54 55 |
# File 'lib/vedeu/repositories/store.rb', line 49 def registered return [] if empty? return storage.keys if hash?(storage) return storage.to_a if storage.is_a?(Set) storage end |
#size ⇒ Fixnum
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the number of entries stored.
60 61 62 |
# File 'lib/vedeu/repositories/store.rb', line 60 def size storage.size end |