Class: Yes::Core::Aggregate::Dsl::CommandData
- Inherits:
-
Object
- Object
- Yes::Core::Aggregate::Dsl::CommandData
- Defined in:
- lib/yes/core/aggregate/dsl/command_data.rb
Overview
Data object that holds information about a command definition in an aggregate
Instance Attribute Summary collapse
- #aggregate_class ⇒ Object readonly
- #aggregate_name ⇒ Object readonly
- #authorizer_block ⇒ Object
- #context_name ⇒ Object readonly
- #encrypted_attributes ⇒ Object
- #event_name ⇒ Object
- #guard_names ⇒ Object
- #name ⇒ Object readonly
- #payload_attributes ⇒ Object
- #update_state_block ⇒ Object
Instance Method Summary collapse
-
#add_guard(name) ⇒ void
Add a guard name to the list of guards.
-
#initialize(name, aggregate_class, options = {}) ⇒ CommandData
constructor
A new instance of CommandData.
Constructor Details
#initialize(name, aggregate_class, options = {}) ⇒ CommandData
Returns a new instance of CommandData.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 24 def initialize(name, aggregate_class, = {}) @name = name @aggregate_class = aggregate_class @context_name = .delete(:context) @aggregate_name = .delete(:aggregate) # Default event name based on command name (will be overridden if specified in DSL) @event_name = .delete(:event_name) || Yes::Core::Utils::EventNameResolver.call(name) # Default payload is just the aggregate_id @payload_attributes = .delete(:payload_attributes) || {} # Store guard names @guard_names = [] # Track encrypted attributes for event schema generation @encrypted_attributes = [] end |
Instance Attribute Details
#aggregate_class ⇒ Object (readonly)
13 14 15 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 13 def aggregate_class @aggregate_class end |
#aggregate_name ⇒ Object (readonly)
13 14 15 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 13 def aggregate_name @aggregate_name end |
#authorizer_block ⇒ Object
14 15 16 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 14 def @authorizer_block end |
#context_name ⇒ Object (readonly)
13 14 15 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 13 def context_name @context_name end |
#encrypted_attributes ⇒ Object
14 15 16 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 14 def encrypted_attributes @encrypted_attributes end |
#event_name ⇒ Object
14 15 16 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 14 def event_name @event_name end |
#guard_names ⇒ Object
14 15 16 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 14 def guard_names @guard_names end |
#name ⇒ Object (readonly)
13 14 15 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 13 def name @name end |
#payload_attributes ⇒ Object
14 15 16 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 14 def payload_attributes @payload_attributes end |
#update_state_block ⇒ Object
14 15 16 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 14 def update_state_block @update_state_block end |
Instance Method Details
#add_guard(name) ⇒ void
This method returns an undefined value.
Add a guard name to the list of guards
47 48 49 |
# File 'lib/yes/core/aggregate/dsl/command_data.rb', line 47 def add_guard(name) @guard_names << name end |