Class: Artifactory::GemImport::Gem::Errors

Inherits:
Object
  • Object
show all
Defined in:
lib/artifactory/gem_import/gem/errors.rb

Instance Method Summary collapse

Constructor Details

#initializeErrors

Returns a new instance of Errors.



5
6
7
# File 'lib/artifactory/gem_import/gem/errors.rb', line 5

def initialize
  @errors = Hash.new { |h, k| h[k] = [] }
end

Instance Method Details

#add(key, msg) ⇒ Object



9
10
11
12
# File 'lib/artifactory/gem_import/gem/errors.rb', line 9

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

#any?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/artifactory/gem_import/gem/errors.rb', line 14

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

#full_message(key) ⇒ Object



29
30
31
# File 'lib/artifactory/gem_import/gem/errors.rb', line 29

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

#full_messagesObject



22
23
24
25
26
27
# File 'lib/artifactory/gem_import/gem/errors.rb', line 22

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

#on(key) ⇒ Object



18
19
20
# File 'lib/artifactory/gem_import/gem/errors.rb', line 18

def on(key)
  @errors[key]
end