Module: Olyx::Guardrails::Pii::DateValidator
- Defined in:
- lib/olyx/guardrails/pii/date_validator.rb
Overview
Validates labeled date-of-birth candidates as real calendar dates.
Constant Summary collapse
- DATE =
%r{(?:\d{1,4}[/-]\d{1,2}[/-]\d{1,4}|[A-Za-z]+\.?\s+\d{1,2},?\s+\d{4})}
Class Method Summary collapse
Class Method Details
.call(value) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/olyx/guardrails/pii/date_validator.rb', line 16 def call(value) candidate = value[DATE] return false unless candidate candidate.match?(/\A\d/) ? NumericDateValidator.call(candidate) : NamedDateValidator.call(candidate) end |