Class: Replay::Backends::MemoryStore

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/replay/backends.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMemoryStore

Returns a new instance of MemoryStore.



15
16
17
# File 'lib/replay/backends.rb', line 15

def initialize
  @store = {}
end

Class Method Details

.[](stream_id) ⇒ Object



42
43
44
# File 'lib/replay/backends.rb', line 42

def self.[](stream_id)
  instance.event_stream(stream_id)
end

.clearObject



22
23
24
# File 'lib/replay/backends.rb', line 22

def self.clear
  instance.clear
end

.event_stream(stream_id) ⇒ Object



39
40
41
# File 'lib/replay/backends.rb', line 39

def self.event_stream(stream_id)
  instance.event_stream(stream_id)
end

.published(envelope) ⇒ Object



18
19
20
# File 'lib/replay/backends.rb', line 18

def self.published(envelope)
  instance.published(envelope)
end

Instance Method Details

#clearObject



26
27
28
# File 'lib/replay/backends.rb', line 26

def clear
  @store = {}
end

#event_stream(stream_id) ⇒ Object



35
36
37
# File 'lib/replay/backends.rb', line 35

def event_stream(stream_id)
  @store[stream_id] || []
end

#published(envelope) ⇒ Object



30
31
32
33
# File 'lib/replay/backends.rb', line 30

def published(envelope)
  @store[stream_id] ||= []
  @store[stream_id] << envelope
end