Sha256: 689391bf8838cec69c555e72e77298241bd8d5ec10da7ed080645eb70fd827de

Contents?: true

Size: 611 Bytes

Versions: 3

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

require 'rainbow'

module Consyncful
  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

3 entries across 3 versions & 1 rubygems

Version Path
consyncful-0.4.0 lib/consyncful/stats.rb
consyncful-0.3.3 lib/consyncful/stats.rb
consyncful-0.3.2 lib/consyncful/stats.rb