Class: Socrates::Storage::MemoryStorage
- Inherits:
-
Object
- Object
- Socrates::Storage::MemoryStorage
- Defined in:
- lib/socrates/storage/storage.rb
Instance Method Summary collapse
- #clear(key) ⇒ Object
- #get(key) ⇒ Object
- #has_key?(key) ⇒ Boolean
-
#initialize ⇒ MemoryStorage
constructor
A new instance of MemoryStorage.
- #put(key, value) ⇒ Object
Constructor Details
#initialize ⇒ MemoryStorage
7 8 9 |
# File 'lib/socrates/storage/storage.rb', line 7 def initialize @storage = {} end |
Instance Method Details
#clear(key) ⇒ Object
15 16 17 |
# File 'lib/socrates/storage/storage.rb', line 15 def clear(key) @storage.delete key end |
#get(key) ⇒ Object
19 20 21 |
# File 'lib/socrates/storage/storage.rb', line 19 def get(key) @storage[key] end |
#has_key?(key) ⇒ Boolean
11 12 13 |
# File 'lib/socrates/storage/storage.rb', line 11 def has_key?(key) @storage.has_key? key end |
#put(key, value) ⇒ Object
23 24 25 |
# File 'lib/socrates/storage/storage.rb', line 23 def put(key, value) @storage[key] = value end |