Class: Faker::Name
- Inherits:
-
Object
- Object
- Faker::Name
- Defined in:
- lib/faker_es_mx/name.rb
Constant Summary collapse
- MX_NAMES =
{ :female => %w( Maria Guadalupe Carmen Rosa Claudia Fernanda Sofia Ana Karla Laura Martha Alejandra Andrea Silvia Patricia Veronica Monica Margarita Gabriela Isabel Alicia Gloria Elena Rosario Mariana Yolanda Julia Cecilia Angelica Carolina ), :male => %w( Juan Jose Carlos Luis Jesus Manuel Antonio Alberto Francisco Alejandro Fernando Roberto Jorge Eduardo Mario Marco Miguel Victor Rogelio Daniel Sergio Arturo Alfredo Martin Armando Eduardo Enrique Hector ) }
- MX_LAST_NAMES =
%w( Hernandez Garcia Martinez Lopez Gonzalez Gomez Rodriguez Perez Sanchez Rivera Ramirez Flores Villegas Guerrero Monroy Naranjo Vega Fernandez Jimenez Ruiz Diaz Moreno Alvarez Munoz Romero Gutierrez Navarro Torres Vazquez Ramos Serrano Castro Molina Morales Ortega Delgado Rubio Iglesias Santos Castillo Cruz Nunez Garrido Medina Lozano Leon )
- MxFormats =
[ Proc.new { [ mx_prefix, mx_first_name_f, mx_last_name ] }, Proc.new { [ mx_prefix, mx_first_name_m, mx_last_name ] }, Proc.new { [ mx_first_name_f, mx_last_name ] }, Proc.new { [ mx_first_name_f, mx_last_name ] }, Proc.new { [ mx_first_name_f, mx_last_name ] }, Proc.new { [ mx_first_name_f, mx_last_name ] }, Proc.new { [ mx_first_name_m, mx_last_name ] }, Proc.new { [ mx_first_name_m, mx_last_name ] }, Proc.new { [ mx_first_name_m, mx_last_name ] }, Proc.new { [ mx_first_name_m, mx_last_name ] } ]
- MX_PREFIXES =
{ :female => %w(Sra. Srta. Dr. Prof.), :male => %w(Sr. Dr. Prof.) }
Class Method Summary collapse
-
.mx_first_name(gender = nil, double = false) ⇒ Object
Returns a random first name.
-
.mx_first_name_f(double = false) ⇒ Object
Returns a random female first name.
-
.mx_first_name_m(double = false) ⇒ Object
Returns a random male first name.
-
.mx_last_name(double = false) ⇒ Object
Returns a random last name.
-
.mx_name ⇒ Object
Returns a random full name using any of MxFormats.
-
.mx_prefix(gender = nil) ⇒ Object
Returns a random prefix.
Class Method Details
.mx_first_name(gender = nil, double = false) ⇒ Object
Returns a random first name.
50 51 52 53 54 55 |
# File 'lib/faker_es_mx/name.rb', line 50 def mx_first_name(gender = nil, double = false) gender ||= [ :male, :female ].rand name = MX_NAMES[gender].rand name += ' ' + MX_NAMES[gender].rand if double name end |
.mx_first_name_f(double = false) ⇒ Object
Returns a random female first name.
58 59 60 |
# File 'lib/faker_es_mx/name.rb', line 58 def mx_first_name_f(double = false) mx_first_name(:female, double) end |
.mx_first_name_m(double = false) ⇒ Object
Returns a random male first name.
63 64 65 |
# File 'lib/faker_es_mx/name.rb', line 63 def mx_first_name_m(double = false) mx_first_name(:male, double) end |
.mx_last_name(double = false) ⇒ Object
Returns a random last name.
68 69 70 71 72 |
# File 'lib/faker_es_mx/name.rb', line 68 def mx_last_name(double = false) name = MX_LAST_NAMES.rand name += ' ' + MX_LAST_NAMES.rand if double name end |
.mx_name ⇒ Object
Returns a random full name using any of MxFormats.
45 46 47 |
# File 'lib/faker_es_mx/name.rb', line 45 def mx_name MxFormats.rand.call.join ' ' end |
.mx_prefix(gender = nil) ⇒ Object
Returns a random prefix.
75 76 77 78 |
# File 'lib/faker_es_mx/name.rb', line 75 def mx_prefix(gender = nil) gender ||= [ :male, :female ].rand MX_PREFIXES[gender].rand end |