Class: Dlme::RecordCounter

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/record_counter.rb

Overview

A singleton counter for records.

Instance Method Summary collapse

Constructor Details

#initializeRecordCounter

Returns a new instance of RecordCounter.


8
9
10
# File 'lib/record_counter.rb', line 8

def initialize
  @counter = Concurrent::AtomicFixnum.new(0)
end

Instance Method Details

#countObject


16
17
18
# File 'lib/record_counter.rb', line 16

def count
  @counter.value
end

#incrementObject


12
13
14
# File 'lib/record_counter.rb', line 12

def increment
  @counter.increment
end