Module: RubyCqrs::Domain::Aggregate

Includes:
Contracts, Contracts::Modules
Defined in:
lib/ruby_cqrs/domain/aggregate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aggregate_idObject (readonly)

Returns the value of attribute aggregate_id.



11
12
13
# File 'lib/ruby_cqrs/domain/aggregate.rb', line 11

def aggregate_id
  @aggregate_id
end

#versionObject (readonly)

Returns the value of attribute version.



11
12
13
# File 'lib/ruby_cqrs/domain/aggregate.rb', line 11

def version
  @version
end

Instance Method Details

#initializeObject



14
15
16
17
18
19
20
21
# File 'lib/ruby_cqrs/domain/aggregate.rb', line 14

def initialize
  @aggregate_id = Guid.create
  @version = 0
  @source_version = 0
  @event_handler_cache = {}
  @pending_events = []
  super
end

#is_version_conflicted?(client_side_version) ⇒ Boolean

Returns:



24
25
26
# File 'lib/ruby_cqrs/domain/aggregate.rb', line 24

def is_version_conflicted? client_side_version
  client_side_version != @source_version
end