Module: RequestParamsValidation::Params::Validators::Inclusion
- Defined in:
- lib/request_params_validation/params/validators/inclusion.rb
Instance Method Summary collapse
Instance Method Details
#default_invalid_inclusion_message(include_in) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/request_params_validation/params/validators/inclusion.rb', line 17 def (include_in) if param.element_of_array? "All elements values of the array should be in #{include_in}" else "Value should be in #{include_in}" end end |
#validate_inclusion! ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/request_params_validation/params/validators/inclusion.rb', line 5 def validate_inclusion! include_in = param.inclusion.in unless include_in.include?(value) raise_error( :on_invalid_parameter_inclusion, include_in: include_in, details: param.inclusion. || (include_in) ) end end |