Class: Faker::FunnyName
Constant Summary
Constants inherited from Base
Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters
Class Method Summary collapse
-
.four_word_name ⇒ String
Retrieves a funny four word name.
-
.name ⇒ String
Retrieves a funny name.
-
.name_with_initial ⇒ String
Retrieves a funny name with an initial.
-
.three_word_name ⇒ String
Retrieves a funny three word name.
-
.two_word_name ⇒ String
Retrieves a funny two word name.
Methods inherited from Base
bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, shuffle!, translate, unique, with_locale
Class Method Details
.four_word_name ⇒ String
Retrieves a funny four word name.
64 65 66 67 68 69 70 |
# File 'lib/faker/default/funny_name.rb', line 64 def four_word_name four_word_names = fetch_all('funny_name.name').select do |name| name.count(' ') == 3 end sample(four_word_names) end |
.name ⇒ String
Retrieves a funny name.
17 18 19 |
# File 'lib/faker/default/funny_name.rb', line 17 def name fetch('funny_name.name') end |
.name_with_initial ⇒ String
Retrieves a funny name with an initial.
81 82 83 84 85 86 87 |
# File 'lib/faker/default/funny_name.rb', line 81 def name_with_initial names_with_initials = fetch_all('funny_name.name').select do |name| name.count('.').positive? end sample(names_with_initials) end |
.three_word_name ⇒ String
Retrieves a funny three word name.
47 48 49 50 51 52 53 |
# File 'lib/faker/default/funny_name.rb', line 47 def three_word_name three_word_names = fetch_all('funny_name.name').select do |name| name.count(' ') == 2 end sample(three_word_names) end |
.two_word_name ⇒ String
Retrieves a funny two word name.
30 31 32 33 34 35 36 |
# File 'lib/faker/default/funny_name.rb', line 30 def two_word_name two_word_names = fetch_all('funny_name.name').select do |name| name.count(' ') == 1 end sample(two_word_names) end |