Class: Apia::ManifestErrors::Errors

Inherits:
Object
  • Object
show all
Defined in:
lib/apia/manifest_errors.rb

Instance Method Summary collapse

Constructor Details

#initializeErrors

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: 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

Returns:

  • (Boolean)


47
48
49
# File 'lib/apia/manifest_errors.rb', line 47

def empty?
  @errors.empty?
end

#include?(code) ⇒ Boolean

Returns:

  • (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