Class: Eid::Estonia
Instance Attribute Summary
Attributes inherited from Core
#identity
Instance Method Summary
collapse
Methods inherited from Core
#age, #gender, #initialize
Constructor Details
This class inherits a constructor from Eid::Core
Instance Method Details
#birth_date ⇒ Object
23
24
25
26
27
|
# File 'lib/eid/estonia.rb', line 23
def birth_date
Date.new((century + identity[1..2].to_i), identity[3..4].to_i, identity[5..6].to_i)
rescue StandardError
nil
end
|
#female? ⇒ Boolean
15
16
17
|
# File 'lib/eid/estonia.rb', line 15
def female?
identity[0].to_i.even?
end
|
#male? ⇒ Boolean
19
20
21
|
# File 'lib/eid/estonia.rb', line 19
def male?
identity[0].to_i.odd?
end
|
#valid? ⇒ Boolean
NOTE: identity GYYMMDDSSSC G – gender (even for female, odd for male) YYMMDD – date of birth SSS – serial number C – checksum
11
12
13
|
# File 'lib/eid/estonia.rb', line 11
def valid?
valid_format? && birth_date.is_a?(Date)
end
|