Class: Artifactory::Permissions::Errors
- Inherits:
-
Object
- Object
- Artifactory::Permissions::Errors
- Defined in:
- lib/artifactory/permissions/errors.rb
Instance Method Summary collapse
- #add(key, msg) ⇒ Object
- #any? ⇒ Boolean
- #empty? ⇒ Boolean (also: #none?)
- #full_message(key) ⇒ Object
- #full_messages ⇒ Object
-
#initialize ⇒ Errors
constructor
A new instance of Errors.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
4 5 6 |
# File 'lib/artifactory/permissions/errors.rb', line 4 def initialize @errors = Hash.new { |h, k| h[k] = [] } end |
Instance Method Details
#add(key, msg) ⇒ Object
8 9 10 11 |
# File 'lib/artifactory/permissions/errors.rb', line 8 def add(key, msg) @errors[key] << msg self end |
#any? ⇒ Boolean
19 20 21 |
# File 'lib/artifactory/permissions/errors.rb', line 19 def any? @errors.values.flatten.any? end |
#empty? ⇒ Boolean Also known as: none?
13 14 15 |
# File 'lib/artifactory/permissions/errors.rb', line 13 def empty? !any? end |
#full_message(key) ⇒ Object
30 31 32 |
# File 'lib/artifactory/permissions/errors.rb', line 30 def (key) @errors[key].join(", ") end |
#full_messages ⇒ Object
23 24 25 26 27 28 |
# File 'lib/artifactory/permissions/errors.rb', line 23 def @errors .keys .map { |key| [key, (key)].join(": ") } .join("; ") end |
#to_h ⇒ Object
34 35 36 |
# File 'lib/artifactory/permissions/errors.rb', line 34 def to_h @errors.dup end |