Module: Faker::NameCS
- Extended by:
- ModuleUtils, NameCS
- Includes:
- Name
- Included in:
- NameCS
- Defined in:
- lib/ffakerer/name_cs.rb
Constant Summary collapse
- FIRST_NAMES =
{ :female => k(%w(Alena Andrea Anna Barbora Božena Dagmar Dana Eliška Eva Hana Helena Irena Ivana Jana Jarmila Jaroslava Jiřina Jitka Kateřina Kristýna Lenka Libuše Lucie Ludmila Marcela Marie Markéta Marta Martina Michaela Miroslava Monika Pavla Petra Tereza Věra Veronika Vlasta Zdeňka Zuzana)), :male => k(%w(Adam Aleš Alexandr Alois Antonín Bedřich Bohumil Bohuslav Břetislav Dalibor Daniel David Denis Dominik Dušan Eduard Emil Filip František Ivan Ivo Jakub Jan Jaromír Jaroslav Jindřich Jiří Josef Jozef Kamil Karel Kryštof Ladislav Leoš Libor Lubomír Luboš Luděk Ludvík Lukáš Marcel Marek Marian Martin Matěj Matyáš Michael Michal Milan Miloslav Miloš Miroslav Oldřich Ondřej Otakar Patrik Pavel Petr Přemysl Radek Radim Radomír Radovan René Richard Robert Roman Rostislav Rudolf Samuel Stanislav Šimon Štefan Štěpán Tadeáš Tomáš Václav Viktor Vilém Vít Vítězslav Vladimír Vladislav Vlastimil Vojtěch Vratislav Zbyněk Zdeněk)) }
- LAST_NAMES =
{ :female => k(%w(Dvořáková Černá Benešová Fialová Doležalová Čermáková Blažková Bartošová Čechová Dostálová Bláhová Burešová Dušková Beranová Bednářová Bártová Fišerová Bílková Beránková Brožová Čížková Adámková Daňková Filipová Červenková Čapková Bendová Adamcová Dvořáčková Brabcová Davidová Březinová Dlouhá Dohnalová Burianová Dufková Fojtíková Burdová Červená Boháčová Bartoňová Doleželová Dudová Adamová Bauerová Divišová Coufalová Čejková Berková Balážová)), :male => k(%w(Dvořák Černý Beneš Fiala Doležal Čermák Blažek Bartoš Čech Dostál Bláha Bureš Dušek Beran Bednář Bárta Bílek Beránek Fišer Brož Čížek Filip Červenka Adámek Daněk Dvořáček Benda Adamec Brabec Březina David Burian Čapek Dohnal Dlouhý Fojtík Bartoň Červený Dufek Burda Duda Adam Boháč Doležel Baláž Diviš Coufal Bauer Dolejší)) }
- SUFFIXES =
k %w(Ph.D. Th.D. DSc.)
Constants included from Name
Instance Method Summary collapse
-
#first_name(for_sex = :random) ⇒ Object
Generates random first name for_sex can be :male, :female.
-
#last_name(for_sex = :random) ⇒ Object
Generates random last name for_sex can be :male, :female.
-
#name(for_sex = :random) ⇒ Object
Generates random full name which can contain prefix and suffix Can be called with explicit sex (:male, :female), like:.
-
#prefix ⇒ Object
Generates random name prefix, an academic degree.
-
#suffix ⇒ Object
Generates random name suffix, an academic degree.
-
#with_same_sex(sex = :random) ⇒ Object
All names generated inside the block will have the same sex.
Methods included from ModuleUtils
Instance Method Details
#first_name(for_sex = :random) ⇒ Object
Generates random first name for_sex can be :male, :female. Defaults to :random
54 55 56 |
# File 'lib/ffakerer/name_cs.rb', line 54 def first_name(for_sex = :random) FIRST_NAMES[select_sex(for_sex)].rand end |
#last_name(for_sex = :random) ⇒ Object
Generates random last name for_sex can be :male, :female. Defaults to :random
48 49 50 |
# File 'lib/ffakerer/name_cs.rb', line 48 def last_name(for_sex = :random) LAST_NAMES[select_sex(for_sex)].rand end |
#name(for_sex = :random) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/ffakerer/name_cs.rb', line 36 def name(for_sex = :random) with_same_sex(for_sex) do case rand(10) when 0 then "#{prefix} #{first_name} #{last_name} #{suffix}" when 1..2 then "#{prefix} #{first_name} #{last_name}" else "#{first_name} #{last_name}" end end end |
#prefix ⇒ Object
Generates random name prefix, an academic degree
59 60 61 |
# File 'lib/ffakerer/name_cs.rb', line 59 def prefix PREFIXES.rand end |
#suffix ⇒ Object
Generates random name suffix, an academic degree
64 65 66 |
# File 'lib/ffakerer/name_cs.rb', line 64 def suffix SUFFIXES.rand end |
#with_same_sex(sex = :random) ⇒ Object
All names generated inside the block will have the same sex. Can be called with explicit sex which will affect all calls inside thee block:
Faker::NameCS.with_same_sex(:female)
person.last_name = Faker::NameCS.last_name
person.first_name = Faker::NameCS.first_name
end
person.last_name # => "Nováková"
person.first_name # => "Jana"
23 24 25 26 27 28 |
# File 'lib/ffakerer/name_cs.rb', line 23 def with_same_sex(sex = :random) @fixed_sex = sex == :random ? GENDERS[rand(2)] : sex yield ensure @fixed_sex = nil end |