Class: Nif::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/nif.rb

Class Method Summary collapse

Class Method Details

.validate(value) ⇒ Object



29
30
31
32
33
# File 'lib/nif.rb', line 29

def self.validate value
  return false unless NifGenerator.is_integer? value
  return false if value.length != 9
  NifGenerator.calculate_check_digit(value)  == value[8,1].to_i
end