Class: RServiceBus2::StateStorageInMemory

Inherits:
Object
  • Object
show all
Defined in:
lib/rservicebus2/state_storage/inmemory.rb

Overview

StateStorage InMemory

Instance Method Summary collapse

Constructor Details

#initialize(_uri) ⇒ StateStorageInMemory

Returns a new instance of StateStorageInMemory.



4
5
6
# File 'lib/rservicebus2/state_storage/inmemory.rb', line 4

def initialize(_uri)
  @hash = {}
end

Instance Method Details

#beginObject



8
9
10
# File 'lib/rservicebus2/state_storage/inmemory.rb', line 8

def begin
  @list = []
end

#commitObject



19
20
21
22
23
# File 'lib/rservicebus2/state_storage/inmemory.rb', line 19

def commit
  @list.each do |e|
    @hash[e['name']] = e['hash']
  end
end

#get(handler) ⇒ Object



12
13
14
15
16
17
# File 'lib/rservicebus2/state_storage/inmemory.rb', line 12

def get(handler)
  hash = @hash[handler.class.name]
  @list << Hash['name', handler.class.name, 'hash', hash]

  hash
end