Sha256: 9e159d1e3271fe7fedcde12a9cacce754d3f6f0b397eed9eeb44d045ff7dd26a

Contents?: true

Size: 631 Bytes

Versions: 4

Compression:

Stored size: 631 Bytes

Contents

module Artifactory
  module GemImport
    class Gem
      class Errors
        def initialize
          @errors = Hash.new { |h, k| h[k] = [] }
        end

        def add(key, msg)
          @errors[key] << msg
          self
        end

        def any?
          @errors.values.flatten.any?
        end

        def on(key)
          @errors[key]
        end

        def full_messages
          @errors
            .keys
            .map { |key| [key, full_message(key)].join(": ") }
            .join("; ")
        end

        def full_message(key)
          @errors[key].join(", ")
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
artifactory-gem_import-0.2.2 lib/artifactory/gem_import/gem/errors.rb
artifactory-gem_import-0.2.0 lib/artifactory/gem_import/gem/errors.rb
artifactory-gem_import-0.1.4 lib/artifactory/gem_import/gem/errors.rb
artifactory-gem_import-0.1.3 lib/artifactory/gem_import/gem/errors.rb