Class: Seekmodo::Sdk::Storage::Memory::EventQueueStore
- Inherits:
-
Object
- Object
- Seekmodo::Sdk::Storage::Memory::EventQueueStore
- Includes:
- Protocols::EventQueueStore
- Defined in:
- lib/seekmodo/sdk/storage/memory/stores.rb
Instance Method Summary collapse
- #count ⇒ Object
- #drain(max_events) ⇒ Object
-
#initialize ⇒ EventQueueStore
constructor
A new instance of EventQueueStore.
- #push(event) ⇒ Object
Constructor Details
#initialize ⇒ EventQueueStore
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
#count ⇒ Object
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 |