Class: Aggregates::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_filtersObject (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_processorsObject (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_processorsObject (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_backendObject (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