Class: ParamsChecker::ParamChecker::HashParamChecker
Instance Attribute Summary
#key, #params, #schema
Instance Method Summary
collapse
#add_field_error, #initialize
Instance Method Details
#call ⇒ Object
126
127
128
129
130
|
# File 'lib/params_checker/param_checker.rb', line 126
def call
return nil if schema[key][:allow_nil] && params[key].nil?
check_type && params[key]
end
|
#check_type ⇒ Object
132
133
134
135
136
|
# File 'lib/params_checker/param_checker.rb', line 132
def check_type
valid = params[key].is_a? Hash
add_field_error("This field's type must be hash.") unless valid
valid
end
|