Class: NationalIdentificationNumber::Base
- Inherits:
-
Object
- Object
- NationalIdentificationNumber::Base
show all
- Defined in:
- lib/national_identification_number/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(number) ⇒ Base
Returns a new instance of Base.
6
7
8
9
10
|
# File 'lib/national_identification_number/base.rb', line 6
def initialize(number)
@number = number
repair
validate
end
|
Instance Method Details
#==(other) ⇒ Object
28
29
30
|
# File 'lib/national_identification_number/base.rb', line 28
def ==(other)
other.class == self.class && other&.to_s == to_s
end
|
#age ⇒ Object
24
25
26
|
# File 'lib/national_identification_number/base.rb', line 24
def age
age_for_dob date
end
|
#sanitize ⇒ Object
20
21
22
|
# File 'lib/national_identification_number/base.rb', line 20
def sanitize
to_s if valid?
end
|
#to_s ⇒ Object
16
17
18
|
# File 'lib/national_identification_number/base.rb', line 16
def to_s
@number
end
|
#valid? ⇒ Boolean
12
13
14
|
# File 'lib/national_identification_number/base.rb', line 12
def valid?
!!@valid
end
|