Class: Yes::Core::CommandHandling::AggregateTracker
- Inherits:
-
Object
- Object
- Yes::Core::CommandHandling::AggregateTracker
- Defined in:
- lib/yes/core/command_handling/aggregate_tracker.rb
Overview
Tracks external aggregate access during command handling
Instance Attribute Summary collapse
-
#accessed_external_aggregates ⇒ Array<Hash>
readonly
List of accessed external aggregates with their revisions.
Instance Method Summary collapse
-
#initialize ⇒ AggregateTracker
constructor
A new instance of AggregateTracker.
-
#track(attribute_name:, id:, revision:, context:) ⇒ void
Tracks an external aggregate access.
Constructor Details
#initialize ⇒ AggregateTracker
Returns a new instance of AggregateTracker.
11 12 13 |
# File 'lib/yes/core/command_handling/aggregate_tracker.rb', line 11 def initialize @accessed_external_aggregates = [] end |
Instance Attribute Details
#accessed_external_aggregates ⇒ Array<Hash> (readonly)
Returns List of accessed external aggregates with their revisions.
9 10 11 |
# File 'lib/yes/core/command_handling/aggregate_tracker.rb', line 9 def accessed_external_aggregates @accessed_external_aggregates end |
Instance Method Details
#track(attribute_name:, id:, revision:, context:) ⇒ void
This method returns an undefined value.
Tracks an external aggregate access
22 23 24 25 26 27 28 29 |
# File 'lib/yes/core/command_handling/aggregate_tracker.rb', line 22 def track(attribute_name:, id:, revision:, context:) accessed_external_aggregates << { id:, context:, name: attribute_name.to_s.camelize, revision: } end |