Class: Fray::Data::ErrorSet

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

Instance Method Summary collapse

Constructor Details

#initialize(array) ⇒ ErrorSet

Returns a new instance of ErrorSet.



8
9
10
11
12
13
14
15
16
17
# File 'lib/fray/data/error_set.rb', line 8

def initialize(array)
  if array.all?{|elt| elt.is_a?(Fray::Data::Error)}
    super(array)
    self.freeze
  else
    msg = "All elements of a Fray::Data::ErrorSet must be instances of Fray::Data::Error. Got: #{array.inspect}"

    raise ArgumentError, msg
  end
end