Class: ParamsChecker::ParamChecker::TimeParamChecker
Instance Attribute Summary
#fields, #key, #opts
Instance Method Summary
collapse
#add_error, #initialize
Instance Method Details
#call ⇒ Object
220
221
222
223
224
|
# File 'lib/params_checker/param_checker.rb', line 220
def call
return nil if fields[key][:allow_nil] && opts[key].nil?
formatted_time
end
|
226
227
228
229
230
|
# File 'lib/params_checker/param_checker.rb', line 226
def formatted_time
Time.parse opts[key]
rescue => e
add_error 'Invalid time.'
end
|