Module: RubyEventStore::ProcessManager::ProcessMethods

Defined in:
lib/ruby_event_store/process_manager.rb

Instance Method Summary collapse

Instance Method Details

#call(event) ⇒ Object



9
10
11
12
13
14
# File 'lib/ruby_event_store/process_manager.rb', line 9

def call(event)
  ensure_configured!
  @id = fetch_id(event)
  build_state(event)
  act
end

#replay(events) ⇒ Object



16
17
18
19
# File 'lib/ruby_event_store/process_manager.rb', line 16

def replay(events)
  @state = initial_state
  events.map { |event| @state = apply(event) }
end

#with(event_store:, command_bus:) ⇒ Object



21
22
23
24
25
# File 'lib/ruby_event_store/process_manager.rb', line 21

def with(event_store:, command_bus:)
  @event_store = event_store
  @command_bus = command_bus
  self
end