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.
4 5 6 |
# File 'lib/crabfarm/state_store.rb', line 4 def initialize reset end |
Instance Method Details
#fetch(key, &block) ⇒ Object
8 9 10 |
# File 'lib/crabfarm/state_store.rb', line 8 def fetch(key, &block) @data.fetch(key.to_sym, &block) end |
#reset ⇒ Object
16 17 18 |
# File 'lib/crabfarm/state_store.rb', line 16 def reset @data = Hash.new end |
#set(key, value) ⇒ Object
12 13 14 |
# File 'lib/crabfarm/state_store.rb', line 12 def set(key, value) @data[key.to_sym] = value end |