Class: Nestene::MemoryStorage
- Inherits:
-
Object
- Object
- Nestene::MemoryStorage
- Defined in:
- lib/nestene/storage.rb
Instance Method Summary collapse
- #delete(key) ⇒ Object
-
#initialize ⇒ MemoryStorage
constructor
A new instance of MemoryStorage.
- #list ⇒ Object
- #load(key) ⇒ Object
- #store(key, value) ⇒ Object
Constructor Details
#initialize ⇒ MemoryStorage
Returns a new instance of MemoryStorage.
65 66 67 |
# File 'lib/nestene/storage.rb', line 65 def initialize @storage = {} end |
Instance Method Details
#delete(key) ⇒ Object
85 86 87 |
# File 'lib/nestene/storage.rb', line 85 def delete(key) @storage.delete(key) end |
#list ⇒ Object
69 70 71 |
# File 'lib/nestene/storage.rb', line 69 def list @storage.keys end |
#load(key) ⇒ Object
73 74 75 |
# File 'lib/nestene/storage.rb', line 73 def load(key) @storage[key] end |
#store(key, value) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/nestene/storage.rb', line 77 def store(key, value) if value != nil @storage[key] = value else delete(key) end end |