Class: Aggregates::Configuration
- Inherits:
-
Object
- Object
- Aggregates::Configuration
- Includes:
- Singleton
- Defined in:
- lib/aggregates/configuration.rb
Overview
Stores all of the items needed to dictate the exact behavior needed by the application consuming the Aggregates gem.
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.
-
#storage_backend ⇒ Object
readonly
Returns the value of attribute storage_backend.
Instance Method Summary collapse
- #filter_commands_with(command_filter) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #process_commands_with(command_processor) ⇒ Object
- #process_events_with(event_processor) ⇒ Object
- #store_with(storage_backend) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 |
# File 'lib/aggregates/configuration.rb', line 14 def initialize @command_processors = [] @event_processors = [] @command_filters = [] @storage_backend = InMemoryStorageBackend.new end |
Instance Attribute Details
#command_filters ⇒ Object (readonly)
Returns the value of attribute command_filters.
11 12 13 |
# File 'lib/aggregates/configuration.rb', line 11 def command_filters @command_filters end |
#command_processors ⇒ Object (readonly)
Returns the value of attribute command_processors.
11 12 13 |
# File 'lib/aggregates/configuration.rb', line 11 def command_processors @command_processors end |
#event_processors ⇒ Object (readonly)
Returns the value of attribute event_processors.
11 12 13 |
# File 'lib/aggregates/configuration.rb', line 11 def event_processors @event_processors end |
#storage_backend ⇒ Object (readonly)
Returns the value of attribute storage_backend.
11 12 13 |
# File 'lib/aggregates/configuration.rb', line 11 def storage_backend @storage_backend end |
Instance Method Details
#filter_commands_with(command_filter) ⇒ Object
21 22 23 |
# File 'lib/aggregates/configuration.rb', line 21 def filter_commands_with(command_filter) @command_filters << command_filter end |
#process_commands_with(command_processor) ⇒ Object
33 34 35 |
# File 'lib/aggregates/configuration.rb', line 33 def process_commands_with(command_processor) @command_processors << command_processor end |
#process_events_with(event_processor) ⇒ Object
29 30 31 |
# File 'lib/aggregates/configuration.rb', line 29 def process_events_with(event_processor) @event_processors << event_processor end |
#store_with(storage_backend) ⇒ Object
25 26 27 |
# File 'lib/aggregates/configuration.rb', line 25 def store_with(storage_backend) @storage_backend = storage_backend end |