Class: Certmeister::InMemoryStore
- Inherits:
-
Object
- Object
- Certmeister::InMemoryStore
- Includes:
- Enumerable
- Defined in:
- lib/certmeister/in_memory_store.rb
Instance Method Summary collapse
- #each ⇒ Object
- #fetch(cn) ⇒ Object
- #health_check ⇒ Object
-
#initialize(certs = {}) ⇒ InMemoryStore
constructor
A new instance of InMemoryStore.
- #remove(cn) ⇒ Object
- #store(cn, cert) ⇒ Object
Constructor Details
#initialize(certs = {}) ⇒ InMemoryStore
Returns a new instance of InMemoryStore.
9 10 11 12 |
# File 'lib/certmeister/in_memory_store.rb', line 9 def initialize(certs = {}) @certs = certs @healthy = true end |
Instance Method Details
#each ⇒ Object
29 30 31 32 33 |
# File 'lib/certmeister/in_memory_store.rb', line 29 def each @certs.each do |cn, cert| yield cn, cert end end |
#fetch(cn) ⇒ Object
19 20 21 22 |
# File 'lib/certmeister/in_memory_store.rb', line 19 def fetch(cn) fail_if_unhealthy @certs[cn] end |
#health_check ⇒ Object
35 36 37 |
# File 'lib/certmeister/in_memory_store.rb', line 35 def health_check @healthy end |
#remove(cn) ⇒ Object
24 25 26 27 |
# File 'lib/certmeister/in_memory_store.rb', line 24 def remove(cn) fail_if_unhealthy !!@certs.delete(cn) end |
#store(cn, cert) ⇒ Object
14 15 16 17 |
# File 'lib/certmeister/in_memory_store.rb', line 14 def store(cn, cert) fail_if_unhealthy @certs[cn] = cert end |