Sha256: 560798eb2154772f1149da5a4081d6aa68db2756c6fd9f61eef5024c27fed0bd

Contents?: true

Size: 982 Bytes

Versions: 8

Compression:

Stored size: 982 Bytes

Contents

require 'update_repo/version'
require 'update_repo/helpers'

module UpdateRepo
  # Class : Metrics.
  # This class takes care of storing the metrics for processed, failures, etc.
  class Metrics
    include Helpers

    # Constructor for the Metrics class.
    # @param logger [instance] Pointer to the Logger class
    # @return [instance] Instance of the Metrics class
    def initialize(logger)
      @log = logger
      @metrics = { processed: 0, skipped: 0, failed: 0, updated: 0,
                   unchanged: 0, start_time: 0, failed_list: [] }
    end

    # Read the metric 'key'
    # @param key [symbol] the key to read
    # @return [various] Return the value for hash key 'key'
    def [](key)
      @metrics[key]
    end

    # Set the metric 'key' to 'value'
    # @param key [symbol] the key to set
    # @param value [symbol] set 'key' to this value.
    # @return [value] Return the value set.
    def []=(key, value)
      @metrics[key] = value
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
update_repo-0.9.7 lib/update_repo/metrics.rb
update_repo-0.9.6 lib/update_repo/metrics.rb
update_repo-0.9.5 lib/update_repo/metrics.rb
update_repo-0.9.4 lib/update_repo/metrics.rb
update_repo-0.9.3 lib/update_repo/metrics.rb
update_repo-0.9.2 lib/update_repo/metrics.rb
update_repo-0.9.1 lib/update_repo/metrics.rb
update_repo-0.9.0 lib/update_repo/metrics.rb