module RequestParamsValidation::Params::Validators::Format
Public Instance Methods
default_invalid_format_message()
click to toggle source
# File lib/request_params_validation/params/validators/format.rb, line 17 def default_invalid_format_message if param.element_of_array? 'An element of the array has an invalid format' else 'Value format is invalid' end end
validate_format!()
click to toggle source
# 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.message || default_invalid_format_message ) end end