Module: RubyCqrs::Domain::Aggregate

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.



6
7
8
# File 'lib/ruby_cqrs/domain/aggregate.rb', line 6

def aggregate_id
  @aggregate_id
end

#versionObject (readonly)

Returns the value of attribute version.



6
7
8
# File 'lib/ruby_cqrs/domain/aggregate.rb', line 6

def version
  @version
end

Instance Method Details

#initializeObject



8
9
10
11
12
13
14
15
# File 'lib/ruby_cqrs/domain/aggregate.rb', line 8

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:

  • (Boolean)


17
18
19
# File 'lib/ruby_cqrs/domain/aggregate.rb', line 17

def is_version_conflicted? client_side_version
  client_side_version != @source_version
end