Sha256: 0c969260f8220dc3acf2ed9248f87adb05b515315c5d0be23e92cae1c0a4e023

Contents?: true

Size: 691 Bytes

Versions: 11

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

require 'rainbow'

module Consyncful
  ##
  # Responsible for recording changes during a sync for outputting in logs
  class Stats
    def initialize
      @stats = {
        records_added: 0,
        records_updated: 0,
        records_deleted: 0
      }
    end

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

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

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

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
consyncful-1.0.1 lib/consyncful/stats.rb
consyncful-1.0.0 lib/consyncful/stats.rb
consyncful-0.9.0 lib/consyncful/stats.rb
consyncful-0.8.0 lib/consyncful/stats.rb
consyncful-0.7.3 lib/consyncful/stats.rb
consyncful-0.7.2 lib/consyncful/stats.rb
consyncful-0.7.1 lib/consyncful/stats.rb
consyncful-0.7.0 lib/consyncful/stats.rb
consyncful-0.6.2 lib/consyncful/stats.rb
consyncful-0.6.1 lib/consyncful/stats.rb
consyncful-0.5.0 lib/consyncful/stats.rb