Class: Artifactory::Permissions::Errors
- Inherits:
-
Object
- Object
- Artifactory::Permissions::Errors
- Defined in:
- lib/artifactory/permissions/errors.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
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.
6 7 8 |
# File 'lib/artifactory/permissions/errors.rb', line 6 def initialize @errors = Hash.new { |h, k| h[k] = [] } end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/artifactory/permissions/errors.rb', line 4 def errors @errors end |
Instance Method Details
#add(key, msg) ⇒ Object
10 11 12 13 |
# File 'lib/artifactory/permissions/errors.rb', line 10 def add(key, msg) errors[key] << msg self end |
#any? ⇒ Boolean
21 22 23 |
# File 'lib/artifactory/permissions/errors.rb', line 21 def any? errors.values.flatten.any? end |
#empty? ⇒ Boolean Also known as: none?
15 16 17 |
# File 'lib/artifactory/permissions/errors.rb', line 15 def empty? !any? end |
#full_message(key) ⇒ Object
32 33 34 |
# File 'lib/artifactory/permissions/errors.rb', line 32 def (key) errors[key].join(", ") end |
#full_messages ⇒ Object
25 26 27 28 29 30 |
# File 'lib/artifactory/permissions/errors.rb', line 25 def errors .keys .map { |key| [key, (key)].join(": ") } .join("; ") end |
#to_h ⇒ Object
36 37 38 |
# File 'lib/artifactory/permissions/errors.rb', line 36 def to_h errors.dup end |