Class: CurpGenerator::Curp

Inherits:
Object
  • Object
show all
Includes:
Catalogs
Defined in:
lib/curp_generator/curp.rb

Constant Summary collapse

InvalidArgumentError =
Class.new(StandardError)

Constants included from Catalogs

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

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Curp

Returns a new instance of Curp.



14
15
16
17
18
19
20
21
22
# File 'lib/curp_generator/curp.rb', line 14

def initialize(data={})
  @first_name       = data[:first_name]
  @second_name      = data[:second_name]
  @first_last_name  = data[:first_last_name]
  @second_last_name = data[:second_last_name]
  @birth_date       = data[:birth_date]
  @birth_state      = data[:birth_state]
  @gender           = data[:gender]
end

Instance Method Details

#generateObject



24
25
26
27
28
# File 'lib/curp_generator/curp.rb', line 24

def generate
  "#{partial_curp}#{verifier_digit}"
rescue => e
  raise InvalidArgumentError, e
end