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

Returns a new instance of 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

#next_stepObject (readonly)

Returns the value of attribute next_step.



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

def next_step
  @next_step
end

#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

#>>(step) ⇒ Object



18
19
20
# File 'lib/easy_json_matcher/array_content_validator.rb', line 18

def >> (step)
  @next_step = step
end

#call(value:) ⇒ Object



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

def call(value:)
  errors = []
  value.each do |val|
    errors += verifier.call(value: val)
  end
  errors
end