Class: MessageStore::Controls::Iterator::Example

Inherits:
Object
  • Object
show all
Includes:
Read::Iterator
Defined in:
lib/message_store/controls/iterator.rb

Instance Attribute Summary

Attributes included from Read::Iterator

#batch, #batch_index, #starting_position

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Read::Iterator

#advance_batch_index, #batch_depleted?, #get_batch, included, #next, #next_batch_starting_position, #reset, #resupply

Class Method Details

.category?(stream_name) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/message_store/controls/iterator.rb', line 20

def self.category?(stream_name)
  !stream_name.include?('-')
end

Instance Method Details

#last_positionObject



12
13
14
15
16
17
18
# File 'lib/message_store/controls/iterator.rb', line 12

def last_position
  unless self.class.category?(stream_name)
    batch.last.position
  else
    batch.last.global_position
  end
end