Class: Crabfarm::StateStore
- Inherits:
-
Object
- Object
- Crabfarm::StateStore
- Defined in:
- lib/crabfarm/state_store.rb
Instance Method Summary collapse
- #fetch(key, &block) ⇒ Object
-
#initialize ⇒ StateStore
constructor
A new instance of StateStore.
- #reset ⇒ Object
- #set(key, value) ⇒ Object
Constructor Details
#initialize ⇒ StateStore
Returns a new instance of StateStore.
6 7 8 |
# File 'lib/crabfarm/state_store.rb', line 6 def initialize reset end |
Instance Method Details
#fetch(key, &block) ⇒ Object
10 11 12 |
# File 'lib/crabfarm/state_store.rb', line 10 def fetch(key, &block) @data.fetch(key.to_sym, &block) end |
#reset ⇒ Object
18 19 20 |
# File 'lib/crabfarm/state_store.rb', line 18 def reset @data = Hash.new end |
#set(key, value) ⇒ Object
14 15 16 |
# File 'lib/crabfarm/state_store.rb', line 14 def set(key, value) @data[key.to_sym] = value end |