Class: Renalware::Patients::NHSNumberValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/validators/renalware/patients/nhs_number_validator.rb

Overview

Validates an NHS number which should be 10 characters long and confirm to the modulo 11 algorithm where the 10th character is a check digit.

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



8
9
10
11
12
# File 'app/validators/renalware/patients/nhs_number_validator.rb', line 8

def validate_each(record, attribute, value)
  return if value.blank?

  Validator.new(record, attribute, value).validate
end