Class: Seekmodo::Sdk::Storage::Memory::EventQueueStore

Inherits:
Object
  • Object
show all
Includes:
Protocols::EventQueueStore
Defined in:
lib/seekmodo/sdk/storage/memory/stores.rb

Instance Method Summary collapse

Constructor Details

#initializeEventQueueStore

Returns a new instance of EventQueueStore.



79
80
81
# File 'lib/seekmodo/sdk/storage/memory/stores.rb', line 79

def initialize
  @events = []
end

Instance Method Details

#countObject



93
94
95
# File 'lib/seekmodo/sdk/storage/memory/stores.rb', line 93

def count
  @events.length
end

#drain(max_events) ⇒ Object



87
88
89
90
91
# File 'lib/seekmodo/sdk/storage/memory/stores.rb', line 87

def drain(max_events)
  batch = @events.take(max_events)
  @events = @events.drop(max_events)
  batch
end

#push(event) ⇒ Object



83
84
85
# File 'lib/seekmodo/sdk/storage/memory/stores.rb', line 83

def push(event)
  @events << event.dup
end