Class: Identified::GroupNumber

Inherits:
Fixnum
  • Object
show all
Defined in:
lib/identified/ssn/group_number.rb

Overview

Represents the group number of an SSN and performs group number validation.

Instance Method Summary collapse

Instance Method Details

#valid?(area = nil, date_issued = nil) ⇒ Boolean

Returns whether the ssn COULD be a valid ssn group code.

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
# File 'lib/identified/ssn/group_number.rb', line 5

def valid?(area = nil, date_issued = nil)
  # When no date is provided, we assume the date issued is post randomization.
  if !date_issued || date_issued >= SSN::RANDOMIZATION_DATE
    (1..99).include?(self)
  else
    (1..99).include?(self) && valid_high_group?(area, date_issued)
  end
end