Class: Aggregates::Domain
- Inherits:
-
Object
- Object
- Aggregates::Domain
- 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
-
#command_filters ⇒ Object
readonly
Returns the value of attribute command_filters.
-
#command_processors ⇒ Object
readonly
Returns the value of attribute command_processors.
-
#event_processors ⇒ Object
readonly
Returns the value of attribute event_processors.
Instance Method Summary collapse
- #execute_with(storage_backend) ⇒ Object
- #filter_commands_with(*command_filters) ⇒ Object
-
#initialize ⇒ Domain
constructor
A new instance of Domain.
- #process_commands_with(*command_processors) ⇒ Object
- #process_events_with(*event_processors) ⇒ Object
Constructor Details
#initialize ⇒ Domain
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_filters ⇒ Object (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_processors ⇒ Object (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_processors ⇒ Object (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 |