Class: Katalyst::Healthcheck::Store::Memory
- Inherits:
-
Object
- Object
- Katalyst::Healthcheck::Store::Memory
- Defined in:
- lib/katalyst/healthcheck/store/memory.rb
Overview
In-memory store, intended for spec tests and debugging
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
-
#delete(name) ⇒ Object
Remove task state.
-
#initialize(options = {}) ⇒ Memory
constructor
A new instance of Memory.
-
#read ⇒ Array<Hash>
Read state from memory.
-
#update(name, task_state = {}) ⇒ Object
Write state to memory.
Constructor Details
#initialize(options = {}) ⇒ Memory
Returns a new instance of Memory.
12 13 14 15 |
# File 'lib/katalyst/healthcheck/store/memory.rb', line 12 def initialize( = {}) @options = @state = {} end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
10 11 12 |
# File 'lib/katalyst/healthcheck/store/memory.rb', line 10 def state @state end |
Instance Method Details
#delete(name) ⇒ Object
Remove task state
36 37 38 |
# File 'lib/katalyst/healthcheck/store/memory.rb', line 36 def delete(name) update(name, nil) end |
#read ⇒ Array<Hash>
Read state from memory
19 20 21 |
# File 'lib/katalyst/healthcheck/store/memory.rb', line 19 def read state.values end |
#update(name, task_state = {}) ⇒ Object
Write state to memory
26 27 28 29 30 31 32 |
# File 'lib/katalyst/healthcheck/store/memory.rb', line 26 def update(name, task_state = {}) if task_state.nil? state.delete(name) else state[name] = task_state end end |