Class: Aggregates::Domain

Inherits:
Object
  • Object
show all
Defined in:
lib/aggregates/domain.rb

Overview

Defines the collection of command processors, event processors, and command filters that are executed together.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDomain

Returns a new instance of Domain.



12
13
14
15
16
# File 'lib/aggregates/domain.rb', line 12

def initialize
  @command_processors = []
  @event_processors = []
  @command_filters = []
end

Instance Attribute Details

#command_filtersObject (readonly)

Returns the value of attribute command_filters.



10
11
12
# File 'lib/aggregates/domain.rb', line 10

def command_filters
  @command_filters
end

#command_processorsObject (readonly)

Returns the value of attribute command_processors.



10
11
12
# File 'lib/aggregates/domain.rb', line 10

def command_processors
  @command_processors
end

#event_processorsObject (readonly)

Returns the value of attribute event_processors.



10
11
12
# File 'lib/aggregates/domain.rb', line 10

def event_processors
  @event_processors
end

Instance Method Details

#execute_with(storage_backend) ⇒ Object



36
37
38
# File 'lib/aggregates/domain.rb', line 36

def execute_with(storage_backend)
  DomainExecutor.new(storage_backend, self)
end

#filter_commands_with(*command_filters) ⇒ Object



30
31
32
33
34
# File 'lib/aggregates/domain.rb', line 30

def filter_commands_with(*command_filters)
  command_filters.each do |command_filter|
    @command_filters << command_filter
  end
end

#process_commands_with(*command_processors) ⇒ Object



24
25
26
27
28
# File 'lib/aggregates/domain.rb', line 24

def process_commands_with(*command_processors)
  command_processors.each do |command_processor|
    @command_processors << command_processor
  end
end

#process_events_with(*event_processors) ⇒ Object



18
19
20
21
22
# File 'lib/aggregates/domain.rb', line 18

def process_events_with(*event_processors)
  event_processors.each do |event_processor|
    @event_processors << event_processor
  end
end