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.



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

#resetObject



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