Class: Apia::ManifestErrors::Errors
- Inherits:
-
Object
- Object
- Apia::ManifestErrors::Errors
- Defined in:
- lib/apia/manifest_errors.rb
Instance Method Summary collapse
- #add(code:, message:) ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #include?(code) ⇒ Boolean
-
#initialize ⇒ Errors
constructor
A new instance of Errors.
- #map(&block) ⇒ Object
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
35 36 37 |
# File 'lib/apia/manifest_errors.rb', line 35 def initialize @errors = [] end |
Instance Method Details
#add(code:, message:) ⇒ Object
39 40 41 |
# File 'lib/apia/manifest_errors.rb', line 39 def add(code:, message:) @errors << { code: code, message: } end |
#each(&block) ⇒ Object
51 52 53 |
# File 'lib/apia/manifest_errors.rb', line 51 def each(&block) @errors.each(&block) end |
#empty? ⇒ Boolean
47 48 49 |
# File 'lib/apia/manifest_errors.rb', line 47 def empty? @errors.empty? end |
#include?(code) ⇒ Boolean
43 44 45 |
# File 'lib/apia/manifest_errors.rb', line 43 def include?(code) @errors.any? { |e| e[:code] == code } end |
#map(&block) ⇒ Object
55 56 57 |
# File 'lib/apia/manifest_errors.rb', line 55 def map(&block) @errors.map(&block) end |