Module: FFaker::IdentificationMX
- Extended by:
- IdentificationMX, ModuleUtils
- Included in:
- IdentificationMX
- Defined in:
- lib/ffaker/identification_mx.rb
Constant Summary collapse
- CONSONANTS =
%w(B C D F G H J K L M N P Q R S T V W X Y Z).freeze
- VOWELS =
%w(A E I O U).freeze
- HOMOCLAVE =
CONSONANTS + VOWELS + [*'0'..'9']
Instance Method Summary collapse
-
#curp ⇒ Object
es.wikipedia.org/wiki/Clave_%C3%9Anica_de_Registro_de_Poblaci%C3%B3n Clave Única de Registro de Población.
-
#rfc ⇒ Object
es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico) Registro Federal de Contribuyentes (R.F.C.).
-
#rfc_persona_fisica ⇒ Object
es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico) Registro Federal de Contribuyentes (R.F.C.) para persona física.
-
#rfc_persona_moral ⇒ Object
es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico) Registro Federal de Contribuyentes (R.F.C.) para persona moral.
Methods included from ModuleUtils
Methods included from RandomUtils
#fetch_sample, #rand, #shuffle
Instance Method Details
#curp ⇒ Object
es.wikipedia.org/wiki/Clave_%C3%9Anica_de_Registro_de_Poblaci%C3%B3n Clave Única de Registro de Población
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ffaker/identification_mx.rb', line 47 def curp all_letters = CONSONANTS + VOWELS hm = %w(H M) date = ::Time.at(rand * ::Time.now.to_f).strftime('%y%m%d') [ fetch_sample(CONSONANTS), fetch_sample(VOWELS), fetch_sample(all_letters, count: 2).join, date, fetch_sample(hm), fetch_sample(ESTADOS_CURP), fetch_sample(CONSONANTS, count: 3).join, fetch_sample(HOMOCLAVE), rand(10) ].join end |
#rfc ⇒ Object
es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico) Registro Federal de Contribuyentes (R.F.C.)
41 42 43 |
# File 'lib/ffaker/identification_mx.rb', line 41 def rfc fetch_sample([rfc_persona_moral, rfc_persona_fisica]) end |
#rfc_persona_fisica ⇒ Object
es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico) Registro Federal de Contribuyentes (R.F.C.) para persona física
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ffaker/identification_mx.rb', line 17 def rfc_persona_fisica consonants_n = CONSONANTS + ["Ñ"] all_letters = consonants_n + VOWELS date = ::Time.at(rand * ::Time.now.to_f).strftime('%y%m%d') [ fetch_sample(consonants_n), fetch_sample(VOWELS), fetch_sample(all_letters, count: 2).join, date, fetch_sample(HOMOCLAVE, count: 3).join ].join end |
#rfc_persona_moral ⇒ Object
es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico) Registro Federal de Contribuyentes (R.F.C.) para persona moral
32 33 34 35 36 37 |
# File 'lib/ffaker/identification_mx.rb', line 32 def rfc_persona_moral consonants_n_amp = CONSONANTS + ["Ñ", '&'] all_letters = consonants_n_amp + VOWELS date = ::Time.at(rand * ::Time.now.to_f).strftime('%y%m%d') "#{fetch_sample(all_letters, count: 3).join}#{date}#{fetch_sample(HOMOCLAVE, count: 3).join}" end |