class IdNumberLatam::ArDni

Public Class Methods

new(id_number, opts = {}) click to toggle source

This Class allows validating the Argentinean Number (DNI). This document does not have a verification digit.

Calls superclass method
# File lib/id_number_latam/ar_dni.rb, line 6
def initialize(id_number, opts = {})
  super
  @country = :ar
end

Public Instance Methods

format() click to toggle source
# File lib/id_number_latam/ar_dni.rb, line 15
def format
  dni = unformat
  formatted_dni = dni.match(/(\d{2,3})(\d{3})(\d{3})/)[1..-1].join(".")
end
unformat() click to toggle source
# File lib/id_number_latam/ar_dni.rb, line 11
def unformat
  id_number.gsub(/\D/, "")
end
valid?() click to toggle source
# File lib/id_number_latam/ar_dni.rb, line 20
def valid?
  valid_length
end
valid_length() click to toggle source
# File lib/id_number_latam/ar_dni.rb, line 24
def valid_length
  unformat.size == 8
end