Module: RubyCqrs::Domain::Snapshotable

Defined in:
lib/ruby_cqrs/domain/snapshotable.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/ruby_cqrs/domain/snapshotable.rb', line 4

def initialize
  if self.class.const_defined? :SNAPSHOT_THRESHOLD
    @snapshot_threshold = self.class.const_get(:SNAPSHOT_THRESHOLD)
  else
    @snapshot_threshold = 30
  end
  @snapshot_threshold = 30 if @snapshot_threshold <= 0
  @countdown = @snapshot_threshold
  @reset_snapshot_countdown_flag = false
  super
end