Module: FourthDimensional
- Defined in:
- lib/fourth_dimensional.rb,
lib/fourth_dimensional/event.rb,
lib/fourth_dimensional/command.rb,
lib/fourth_dimensional/version.rb,
lib/fourth_dimensional/eventable.rb,
lib/fourth_dimensional/repository.rb,
lib/fourth_dimensional/configuration.rb,
lib/fourth_dimensional/event_loaders.rb,
lib/fourth_dimensional/aggregate_root.rb,
lib/fourth_dimensional/command_handler.rb,
lib/fourth_dimensional/record_projector.rb,
lib/fourth_dimensional/event_loaders/active_record.rb,
lib/generators/fourth_dimensional/install_generator.rb,
lib/generators/fourth_dimensional/migration_generator.rb
Defined Under Namespace
Modules: EventLoaders, Eventable Classes: AggregateRoot, Command, CommandHandler, Configuration, Error, Event, InstallGenerator, MigrationGenerator, RecordProjector, Repository
Constant Summary collapse
- VERSION =
"0.1.4"
Class Method Summary collapse
-
.build_repository ⇒ Object
Iniitlaizes a Repository with the required dependencies.
-
.config ⇒ Object
The singleton instance of Configuration.
-
.configure {|config| ... } ⇒ Object
Yields the Configuration instance.
-
.execute_commands(*commands) ⇒ Object
(also: execute_command)
Runs a single or array of commands through all command handlers, saves commands and applied events, and invokes event handlers.
Class Method Details
.build_repository ⇒ Object
Iniitlaizes a Repository with the required dependencies.
FourthDimensional.repository # => FourthDimensional::Repository
37 38 39 |
# File 'lib/fourth_dimensional.rb', line 37 def self.build_repository Repository.new(event_loader: config.event_loader) end |
.config ⇒ Object
The singleton instance of Configuration
18 19 20 |
# File 'lib/fourth_dimensional.rb', line 18 def self.config @configuration ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
Yields the Configuration instance
FourthDimensional.configure do |config|
config.command_handlers = [
CommentCommandHandler,
PostCommandHandler
]
end
30 31 32 |
# File 'lib/fourth_dimensional.rb', line 30 def self.configure yield config end |
.execute_commands(*commands) ⇒ Object Also known as: execute_command
Runs a single or array of commands through all command handlers, saves commands and applied events, and invokes event handlers.
Fourthdimensional.execute_command(command)
FourthDimensional.execute_commands(command1, command2)
FourthDimensional.execute_commands([command1, command2])
47 48 49 50 51 52 |
# File 'lib/fourth_dimensional.rb', line 47 def self.execute_commands(*commands) repository = build_repository call_command_handlers(repository, commands) saved_events = save_commands_and_events(repository) call_event_handlers(saved_events) end |