Module: RequestParamsValidation::Params
- Includes:
- Constants
- Defined in:
- lib/request_params_validation/params.rb,
lib/request_params_validation/params/constants.rb,
lib/request_params_validation/params/converter.rb,
lib/request_params_validation/params/validator.rb,
lib/request_params_validation/params/validators/type.rb,
lib/request_params_validation/params/validators/value.rb,
lib/request_params_validation/params/types/conversions.rb,
lib/request_params_validation/params/types/validations.rb,
lib/request_params_validation/params/validators/custom.rb,
lib/request_params_validation/params/validators/format.rb,
lib/request_params_validation/params/validators/length.rb,
lib/request_params_validation/params/validators/presence.rb,
lib/request_params_validation/params/validators/inclusion.rb
Defined Under Namespace
Modules: Constants, Converter, Types, Validators Classes: Validator
Constant Summary
Constants included from Constants
Constants::ARRAY_TYPE, Constants::BOOLEAN_FALSE_VALUES, Constants::BOOLEAN_TRUE_VALUES, Constants::BOOLEAN_TYPE, Constants::DATETIME_TYPE, Constants::DATE_TYPE, Constants::DECIMAL_REGEXP, Constants::DECIMAL_TYPE, Constants::EMAIL_REGEXP, Constants::EMAIL_TYPE, Constants::HASH_TYPE, Constants::INTEGER_REGEXP, Constants::INTEGER_TYPE, Constants::STRING_TYPE
Class Method Summary collapse
Class Method Details
.filter!(definition, params) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/request_params_validation/params.rb', line 18 def self.filter!(definition, params) extra_keys = [:controller, :action] # Keys added by Rails filter_params(definition, params, extra_keys).tap do |filtered_params| filtered_params.permit! if filtered_params.respond_to?(:permit!) end end |
.validate!(definition, params) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/request_params_validation/params.rb', line 8 def self.validate!(definition, params) definition.each do |param_definition| next if param_definition.skip?(params) validate_and_coerce_param(param_definition, params) end params end |