Class: ParamsChecker::ParamChecker::BooleanChecker
Instance Attribute Summary
#fields, #key, #opts
Instance Method Summary
collapse
#add_error, #initialize
Instance Method Details
#call ⇒ Object
275
276
277
278
279
|
# File 'lib/params_checker/param_checker.rb', line 275
def call
return nil if fields[key][:allow_nil] && opts[key].nil?
check_type && opts[key]
end
|
#check_type ⇒ Object
281
282
283
284
285
|
# File 'lib/params_checker/param_checker.rb', line 281
def check_type
valid = opts[key].in? [true, false]
add_error("This field's type must be boolean.") unless valid
valid
end
|