Class: CurpGenerator::State

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

Constant Summary

Constants included from Catalogs

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

Constants inherited from Base

Base::InvalidCurpArgumentError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(birth_state) ⇒ State

Returns a new instance of State.



6
7
8
# File 'lib/curp_generator/state.rb', line 6

def initialize(birth_state)
  @birth_state = remove_special_chars(birth_state&.upcase)
end

Class Method Details

.generate(birth_state) ⇒ Object



10
11
12
# File 'lib/curp_generator/state.rb', line 10

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

Instance Method Details

#generateObject



14
15
16
# File 'lib/curp_generator/state.rb', line 14

def generate
  invalid_params? ? missing_birth_state_error! : parsed_state
end