Class: CurpGenerator::BirthDate

Inherits:
Base
  • Object
show all
Defined in:
lib/curp_generator/birth_date.rb

Constant Summary

Constants inherited from Base

CurpGenerator::Base::InvalidCurpArgumentError

Constants included from Catalogs

Catalogs::COMMON_NAMES, Catalogs::COMPOSED_NAMES, Catalogs::FORBIDDEN_WORDS, Catalogs::STATES

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(birth_date) ⇒ BirthDate

Returns a new instance of BirthDate.



4
5
6
# File 'lib/curp_generator/birth_date.rb', line 4

def initialize(birth_date)
  @birth_date = birth_date
end

Class Method Details

.generate(birth_date) ⇒ Object



8
9
10
# File 'lib/curp_generator/birth_date.rb', line 8

def self.generate(birth_date)
  new(birth_date).generate
end

.homoclave_digit(birth_date) ⇒ Object



12
13
14
# File 'lib/curp_generator/birth_date.rb', line 12

def self.homoclave_digit(birth_date)
  new(birth_date).homoclave_digit
end

Instance Method Details

#generateObject



16
17
18
19
# File 'lib/curp_generator/birth_date.rb', line 16

def generate
  validate_params
  parsed_date
end

#homoclave_digitObject



21
22
23
24
# File 'lib/curp_generator/birth_date.rb', line 21

def homoclave_digit
  validate_params
  @birth_date.year < 2000 ? '0' : 'A'
end