class SocialSecurityNumber::It

SocialSecurityNumber::It validates Italy tax code for individuals (Codice fiscale) en.wikipedia.org/wiki/National_identification_number#Italy

Constants

DATE_REGEXP
INVD_REGEXP
REGEXP

Public Instance Methods

day() click to toggle source
# File lib/social_security_number/country/it.rb, line 18
def day
  d = @parsed_civil_number[:day].to_i
  @day = d >= 40 ? d - 40 : d
end
month() click to toggle source
# File lib/social_security_number/country/it.rb, line 13
def month
  months = %w[A B C D E H L M P R S T]
  @month = months.index(@parsed_civil_number[:month]).to_i + 1
end
validate() click to toggle source
# File lib/social_security_number/country/it.rb, line 5
def validate
  @error = if !check_by_regexp(REGEXP)
             'bad number format'
           elsif !birth_date
             'number birth date is invalid'
           end
end