Class: EasyJSONMatcher::ArrayContentValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_json_matcher/array_content_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(verify_with:) ⇒ ArrayContentValidator



6
7
8
# File 'lib/easy_json_matcher/array_content_validator.rb', line 6

def initialize(verify_with:)
  @verifier = verify_with
end

Instance Attribute Details

#verifierObject (readonly)

Returns the value of attribute verifier.



4
5
6
# File 'lib/easy_json_matcher/array_content_validator.rb', line 4

def verifier
  @verifier
end

Instance Method Details

#call(value:) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/easy_json_matcher/array_content_validator.rb', line 10

def call(value:)
  errors = []
  value.each do |val|
    # TODO: You could remove the duplication of array content errors here
    errors += verifier.call(value: val)
  end
  errors
end