Module: Aggregates::WithAggregateHelpers::ClassMethods

Defined in:
lib/aggregates/with_aggregate_helpers.rb

Overview

Class Methods to extend onto the host class.

Instance Method Summary collapse

Instance Method Details

#with_aggregate(type, command, &block) ⇒ Object



8
9
10
11
# File 'lib/aggregates/with_aggregate_helpers.rb', line 8

def with_aggregate(type, command, &block)
  aggregate_id = command.aggregate_id
  with_aggregate_by_id(type, aggregate_id, &block)
end

#with_aggregate_by_id(type, aggregate_id) {|type.get_by_id aggregate_id| ... } ⇒ Object

Yields:

  • (type.get_by_id aggregate_id)


13
14
15
# File 'lib/aggregates/with_aggregate_helpers.rb', line 13

def with_aggregate_by_id(type, aggregate_id)
  yield type.get_by_id aggregate_id
end