Class: Faker::FunnyName

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/default/funny_name.rb

Constant Summary

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.four_word_nameObject


28
29
30
31
32
33
34
# File 'lib/faker/default/funny_name.rb', line 28

def four_word_name
  four_word_names = fetch_all('funny_name.name').select do |name|
    name.count(' ') == 3
  end

  sample(four_word_names)
end

.nameObject


8
9
10
# File 'lib/faker/default/funny_name.rb', line 8

def name
  fetch('funny_name.name')
end

.name_with_initialObject


36
37
38
39
40
41
42
# File 'lib/faker/default/funny_name.rb', line 36

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_nameObject


20
21
22
23
24
25
26
# File 'lib/faker/default/funny_name.rb', line 20

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_nameObject


12
13
14
15
16
17
18
# File 'lib/faker/default/funny_name.rb', line 12

def two_word_name
  two_word_names = fetch_all('funny_name.name').select do |name|
    name.count(' ') == 1
  end

  sample(two_word_names)
end