Class: Yes::Core::Aggregate::Dsl::CommandDefiner
- Inherits:
-
Object
- Object
- Yes::Core::Aggregate::Dsl::CommandDefiner
- Defined in:
- lib/yes/core/aggregate/dsl/command_definer.rb
Overview
Factory class that creates and defines commands on aggregates. Handles the creation and registration of all necessary command-related classes, including validation of attributes and DSL evaluation.
Defined Under Namespace
Classes: DslEvaluator, EventNameResolverError, UndefinedAttributeError
Instance Method Summary collapse
-
#call { ... } ⇒ void
Generates and registers all necessary classes for the command.
-
#initialize(command_data) ⇒ CommandDefiner
constructor
Initializes a new CommandDefiner instance.
Constructor Details
#initialize(command_data) ⇒ CommandDefiner
Initializes a new CommandDefiner instance
41 42 43 |
# File 'lib/yes/core/aggregate/dsl/command_definer.rb', line 41 def initialize(command_data) @command_data = command_data end |
Instance Method Details
#call { ... } ⇒ void
This method returns an undefined value.
Generates and registers all necessary classes for the command. This includes command classes, event classes, a guard evaluator class, a state updater class, as well as defining related methods on the aggregate class.
53 54 55 56 57 58 59 60 |
# File 'lib/yes/core/aggregate/dsl/command_definer.rb', line 53 def call(&block) create_and_register_block_evaluator_classes evaluate_dsl_block(&block) if block validate_event_name validate_accessed_attributes create_and_register_command_classes register_command_events end |