Class: RubyEventStore::RSpec::FetchEvents

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/rspec/fetch_events.rb

Constant Summary collapse

MissingEventStore =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#event_storeObject (readonly)

Returns the value of attribute event_store.



28
29
30
# File 'lib/ruby_event_store/rspec/fetch_events.rb', line 28

def event_store
  @event_store
end

#startObject (readonly)

Returns the value of attribute start.



28
29
30
# File 'lib/ruby_event_store/rspec/fetch_events.rb', line 28

def start
  @start
end

#stream_nameObject (readonly)

Returns the value of attribute stream_name.



28
29
30
# File 'lib/ruby_event_store/rspec/fetch_events.rb', line 28

def stream_name
  @stream_name
end

Instance Method Details

#callObject

Raises:



20
21
22
23
24
25
26
# File 'lib/ruby_event_store/rspec/fetch_events.rb', line 20

def call
  raise MissingEventStore if event_store.nil?
  events = event_store.read
  events = events.stream(stream_name) if stream_name
  events = events.from(start) if start
  events
end

#from(event_id) ⇒ Object



8
9
10
# File 'lib/ruby_event_store/rspec/fetch_events.rb', line 8

def from(event_id)
  @start = event_id
end

#in(event_store) ⇒ Object



16
17
18
# File 'lib/ruby_event_store/rspec/fetch_events.rb', line 16

def in(event_store)
  @event_store = event_store
end

#stream(stream_name) ⇒ Object



12
13
14
# File 'lib/ruby_event_store/rspec/fetch_events.rb', line 12

def stream(stream_name)
  @stream_name = stream_name
end