Sha256: 343e1534aa3e2a1f0418c775049de9518b1a5d8ab7c7c32c66814041b7c33ff3

Contents?: true

Size: 544 Bytes

Versions: 6

Compression:

Stored size: 544 Bytes

Contents

module Artifactory
  module GemImport
    module Bookkeeper
      class Counter < Base
        private

        def init_store
          @store = Hash.new do |store, action|
            store[action] = 0
          end
        end

        def on_message(message)
          subject, action, count = message

          case subject
          when :summary
            @store.dup
          when :reset
            init_store
          else
            @store[action] += count
            self
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
artifactory-gem_import-1.1.0 lib/artifactory/gem_import/bookkeeper/counter.rb
artifactory-gem_import-1.0.0 lib/artifactory/gem_import/bookkeeper/counter.rb
artifactory-gem_import-0.2.2 lib/artifactory/gem_import/bookkeeper/counter.rb
artifactory-gem_import-0.2.0 lib/artifactory/gem_import/bookkeeper/counter.rb
artifactory-gem_import-0.1.4 lib/artifactory/gem_import/bookkeeper/counter.rb
artifactory-gem_import-0.1.3 lib/artifactory/gem_import/bookkeeper/counter.rb