Class: Consyncful::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/consyncful/stats.rb

Overview

Responsible for recording changes during a sync for outputting in logs

Instance Method Summary collapse

Constructor Details

#initializeStats

Returns a new instance of Stats.



9
10
11
12
13
14
15
# File 'lib/consyncful/stats.rb', line 9

def initialize
  @stats = {
    records_added: 0,
    records_updated: 0,
    records_deleted: 0
  }
end

Instance Method Details



29
30
31
32
33
# File 'lib/consyncful/stats.rb', line 29

def print_stats
  puts Rainbow("Added: #{@stats[:records_added]}, \
    updated:  #{@stats[:records_updated]}, \
    deleted: #{@stats[:records_deleted]}").blue
end

#record_addedObject



17
18
19
# File 'lib/consyncful/stats.rb', line 17

def record_added
  @stats[:records_added] += 1
end

#record_deletedObject



25
26
27
# File 'lib/consyncful/stats.rb', line 25

def record_deleted
  @stats[:records_deleted] += 1
end

#record_updatedObject



21
22
23
# File 'lib/consyncful/stats.rb', line 21

def record_updated
  @stats[:records_updated] += 1
end