Class: Dragnet::Validators::Fields::MetaDataFieldValidator
- Inherits:
-
FieldValidator
- Object
- FieldValidator
- Dragnet::Validators::Fields::MetaDataFieldValidator
- Defined in:
- lib/dragnet/validators/fields/meta_data_field_validator.rb
Overview
Base class to validate the fields that are part of the meta-data group. This means: Either String
Array<String> or nil
as value.
Instance Method Summary collapse
-
#validate(key, value) ⇒ nil, Array<String>
Validates the specified attribute as a meta-data field.
Instance Method Details
#validate(key, value) ⇒ nil, Array<String>
Validates the specified attribute as a meta-data field.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dragnet/validators/fields/meta_data_field_validator.rb', line 19 def validate(key, value) return unless value validate_type(key, value, String, Array) if value.is_a?(Array) return if value.empty? validate_array_types(key, value, String) value else [value] end end |