Sha256: ea4b61160529c87f450a866e030009c799c38d63079a04a129ad8050eb4149d9
Contents?: true
Size: 567 Bytes
Versions: 1
Compression:
Stored size: 567 Bytes
Contents
module Valigator module CSV module FieldValidators class Date def initialize(options={}) @options = options end def valid?(value) format ? ::Date.strptime(value, format) : ::Date.parse(value) true rescue ArgumentError false end def error_type 'invalid_date' end def error_message 'Invalid date field' end private def format @options[:format] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
valigator-csv-1.3.0 | lib/valigator/csv/field_validators/date.rb |