Module: RequestParamsValidation::Params::Validators::Format
- Defined in:
- lib/request_params_validation/params/validators/format.rb
Instance Method Summary collapse
Instance Method Details
#default_invalid_format_message ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/request_params_validation/params/validators/format.rb', line 17 def if param.element_of_array? 'An element of the array has an invalid format' else 'Value format is invalid' end end |
#validate_format! ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/request_params_validation/params/validators/format.rb', line 5 def validate_format! regexp = param.format.regexp if value !~ regexp raise_error( :on_invalid_parameter_format, regexp: regexp, details: param.format. || ) end end |