Class: Crabfarm::StateStore

Inherits:
Object
  • Object
show all
Defined in:
lib/crabfarm/state_store.rb

Instance Method Summary collapse

Constructor Details

#initializeStateStore

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

#resetObject



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