Class: InputSanitizer::V2::CleanPayloadCollectionField
- Inherits:
-
Object
- Object
- InputSanitizer::V2::CleanPayloadCollectionField
- Defined in:
- lib/input_sanitizer/v2/clean_payload_collection_field.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/input_sanitizer/v2/clean_payload_collection_field.rb', line 2 def call return nil if [:allow_nil] && data == nil validate_type validate_size result, errors = [], {} data.each_with_index do |value, idx| begin result << converter.call(value, ) rescue InputSanitizer::ValidationError => e errors[idx] = e end end if errors.any? raise InputSanitizer::CollectionError.new(errors) else result end end |