Method: Waw::Validation::OrValidator#convert_and_validate

Defined in:
lib/waw/validation/or_validator.rb

#convert_and_validate(*values) ⇒ Object

Converts and validate



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/waw/validation/or_validator.rb', line 16

def convert_and_validate(*values)
  converted = []
  values.each do |value|
    found = false
    @validators.each do |validator|
      found, val_converted = validator.convert_and_validate(value)
      if found
        converted << val_converted[0]
        break
      end
    end
    return [false, values] unless found
  end
  [true, converted]
end