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