Class: Apia::ErrorSet

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

Instance Method Summary collapse

Instance Method Details

#validate(errors, object) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/apia/error_set.rb', line 6

def validate(errors, object)
  each_with_index do |error, index|
    unless error.respond_to?(:ancestors) && error.ancestors.include?(Apia::Error)
      errors.add object, 'InvalidPotentialError', "Potential error at index #{index} must be a class that inherits from Apia::Error"
    end
  end
end