Class: EasyJSONMatcher::ArrayContentValidator
- Inherits:
-
Object
- Object
- EasyJSONMatcher::ArrayContentValidator
- Defined in:
- lib/easy_json_matcher/array_content_validator.rb
Instance Attribute Summary collapse
-
#verifier ⇒ Object
readonly
Returns the value of attribute verifier.
Instance Method Summary collapse
- #call(value:) ⇒ Object
-
#initialize(verify_with:) ⇒ ArrayContentValidator
constructor
A new instance of ArrayContentValidator.
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
#verifier ⇒ Object (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 |