Sha256: cf832dc86ea8dbce160a5ca39ce875b336492c605bba115b0e8342318db8ab3e
Contents?: true
Size: 399 Bytes
Versions: 16
Compression:
Stored size: 399 Bytes
Contents
module CLIUtils # A Validator to verify whether a Pref answer # is a datetime. class DatetimeValidator < PrefValidator # Runs the Validator against the answer. # @param [Object] text The "text" to evaluate # @return [String] def validate(text) @is_valid = !(DateTime.parse(text) rescue nil).nil? @message = "Response is not a datetime: #{ text }" end end end
Version data entries
16 entries across 16 versions & 1 rubygems