Class: Airflow::Persistence::InMemoryRepository
- Inherits:
-
Object
- Object
- Airflow::Persistence::InMemoryRepository
- Defined in:
- lib/async_flow/persistence.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
- #all ⇒ Object
- #clear ⇒ Object
- #find(id) ⇒ Object
-
#initialize(store = {}) ⇒ InMemoryRepository
constructor
A new instance of InMemoryRepository.
Constructor Details
#initialize(store = {}) ⇒ InMemoryRepository
Returns a new instance of InMemoryRepository.
21 22 23 |
# File 'lib/async_flow/persistence.rb', line 21 def initialize(store = {}) @store = store end |
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
19 20 21 |
# File 'lib/async_flow/persistence.rb', line 19 def store @store end |
Instance Method Details
#all ⇒ Object
25 26 27 |
# File 'lib/async_flow/persistence.rb', line 25 def all store.values end |
#clear ⇒ Object
33 34 35 |
# File 'lib/async_flow/persistence.rb', line 33 def clear @store = {} end |
#find(id) ⇒ Object
29 30 31 |
# File 'lib/async_flow/persistence.rb', line 29 def find(id) @store[id] || raise(EntityNotFound, "missing entity with id #{id}") end |