Class: Memoize::MemoryStore
Overview
MemoryStore is class which store memoization data to memory.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#store ⇒ Object
{{{.
Instance Method Summary collapse
- #delete(key) ⇒ Object
- #delete_all ⇒ Object
- #get(key) ⇒ Object
-
#initialize ⇒ MemoryStore
constructor
A new instance of MemoryStore.
- #set(key, value) ⇒ Object
Methods inherited from Storable
Constructor Details
#initialize ⇒ MemoryStore
Returns a new instance of MemoryStore.
51 52 53 |
# File 'lib/memoize.rb', line 51 def initialize @store = {} end |
Instance Attribute Details
#store ⇒ Object
{{{
49 50 51 |
# File 'lib/memoize.rb', line 49 def store @store end |
Instance Method Details
#delete(key) ⇒ Object
63 64 65 |
# File 'lib/memoize.rb', line 63 def delete(key) @store.delete(key) end |
#delete_all ⇒ Object
67 68 69 |
# File 'lib/memoize.rb', line 67 def delete_all @store = {} end |
#get(key) ⇒ Object
55 56 57 |
# File 'lib/memoize.rb', line 55 def get(key) @store[key] end |
#set(key, value) ⇒ Object
59 60 61 |
# File 'lib/memoize.rb', line 59 def set(key, value) @store[key] = value end |