Class: Dragnet::Validators::Fields::FilesValidator

Inherits:
FieldValidator show all
Defined in:
lib/dragnet/validators/fields/files_validator.rb

Overview

Validates the files field on a Manual Test Record

Instance Method Summary collapse

Instance Method Details

#validate(key, value) ⇒ Array<String>?

Validates the MTR's files array.

Parameters:

  • key (String)

    The name of the key

  • value (Object)

    The value of the key

Returns:

  • (Array<String>, nil)

    If files is an Array or a String then an array is returned, if files is nil then nil is returned.

Raises:



17
18
19
20
21
22
23
24
25
# File 'lib/dragnet/validators/fields/files_validator.rb', line 17

def validate(key, value)
  return unless value

  validate_type(key, value, String, Array)
  value = *value
  validate_array_types(key, value, String)

  value
end